Hello! I've got the problem that the same code works different in debugging mode and in "normal" stand-alone mode. In debug mode - with or without any breakpoints - all works nice, but when I disconnect and run the program stand alone it doesn't work. I use the F020 with µVision2 V2.37 and C51 V7.05. Thanks for any hint! Astrid
Hello! The while(1)-loop is within the else-part. The problem was the test indeed! Thanks very much!!
There is nothing in your code that prevents the program from exiting the main function. Perhaps that is the cause of the second "reset". Typically, the main C function for embedded programs is implemented as follows:
void main (void) { whilw (1) { /*** do something ***/ } }
I don't know that particular chip. But this:
RSTSRC == 0x08
(RSTSRC & 0x08) == 0x08
Ok, I see, my desciption is poor ;-) I use for debugging the Cygnal C8051F Driver, newest version. This is my code:
main() { if ( RSTSRC == 0x08 ) { WDTErrorFlag = 1; Initialize(); ShowError( E_WD ); Wait1Min(); WDTErrorFlag = 0; RSTSRC = 0x10; } else { WDTErrorFlag = 0; DoSomething(); } }
You really will have to be more specific. "It doesn't work" has not ever been a useful description of any malfunction, and probably never will be. So: 0) What does "it works" mean to you? I.e. what does your program do? 1) How exactly does it fail? 2) What "debug mode" are you talking about? MON51?
View all questions in Keil forum