 | Discussion Forum |  |
|
|
Software reset commandNext Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author Eduardo Barg Posted 25-Jun-2002 13:52 GMT Toolset C51 |  Software reset command Eduardo Barg 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.
| | Read-Only Author Alan Chen Posted 25-Jun-2002 15:35 GMT Toolset C51 |  RE: Software reset command Alan Chen http://www.keil.com/support/docs/307.htm | | Read-Only Author Graham Cole Posted 25-Jun-2002 16:40 GMT Toolset C51 |  RE: Software reset command Graham Cole 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.)
| | Read-Only Author Mark Odell Posted 12-Jul-2002 02:09 GMT Toolset C51 |  RE: Software reset command Mark Odell You could try my simple C function that will reset an 8051. Get it at:
http://www.embeddedfw.com | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|