This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Software reset command

Hi,

I used to work with the AVcase compiler, and it had the exit(0) command to reset the microcontroller.
That command doesn't work in Keil.
Is there another command in Keil that resets the 8051.

Best regards,
Eduardo Kluas Barg.

Parents
  • One of the best ways to implement a software invoked reset function is to make use of a watchdog circuit and to deliberately let it time out.

    Jumping to address 0x0000 is all very well, but it does not do the same job as a real reset. However, you can partially rectify this by adding startup code that sets registers etc. to a known initial state.

    The code given in the document given by the link in the previous posting deals with the case where there is one level of interrupts active.

    reset: POP  ACC  ; pop return address
           POP  ACC
           MOV  A,#low(rsx)
           PUSH Acc
           MOV  A,#high(rsx)
           PUSH Acc
           RETI
    rsx:
           CLR  A    ; push 0 as new
           PUSH ACC  ; return address to stack
           PUSH ACC
           RETI      ; execute return of interrupt
    
    (I may have the high and low round the wrong way, but you get the general idea.)

Reply
  • One of the best ways to implement a software invoked reset function is to make use of a watchdog circuit and to deliberately let it time out.

    Jumping to address 0x0000 is all very well, but it does not do the same job as a real reset. However, you can partially rectify this by adding startup code that sets registers etc. to a known initial state.

    The code given in the document given by the link in the previous posting deals with the case where there is one level of interrupts active.

    reset: POP  ACC  ; pop return address
           POP  ACC
           MOV  A,#low(rsx)
           PUSH Acc
           MOV  A,#high(rsx)
           PUSH Acc
           RETI
    rsx:
           CLR  A    ; push 0 as new
           PUSH ACC  ; return address to stack
           PUSH ACC
           RETI      ; execute return of interrupt
    
    (I may have the high and low round the wrong way, but you get the general idea.)

Children
No data