??? 11/15/09 17:05 Modified: 11/15/09 17:06 Read: times |
#170848 - How would that happen? Responding to: ???'s previous message |
Hal Albach said:
If CLR P0.0 is the actual program you are running then it is very possible that your MCU is running off into the "Enchanted Forest" and executing random code. If you add the simple little line "SJMP $" you may achieve your desired results. Your program should look like this:
CLR P0.0 ; turn on LED SJMP $ ; wait here - forever I'm curious how code residing in on-chip ROM/FLASH could go off into the "Enchanted Forest". Wouldn't this mean (a) a defective device or (b) a faulty device design? After all, it shouldn't be possible if the code is rigorously designed, carefully and competently coded, thoroughly debugged, and, last but certainly not least, thoroughly tested once deemed "perfect" in every other way and then stress-tested to well beyond all operating limits just to ensure it behaves predictably for a long, typically 1000 hours, period. I agree that the measure you recommend will mitigate the risk of the code wandering off into the weeds if there's uninitialized code space, but ... after all, it doesn't cost any extra to fill unused code space with NOP's. RE |