??? 09/14/10 15:13 Read: times |
#178556 - Could Also Be Responding to: ???'s previous message |
You end your code execution with a JMP $. It could also be that this gets disrupted somehow by the act of starting to turn power off and causes the code to run astray in FLASH till it recovers at the reset vector and starts over.
I have experienced multiple times that cutting the AC power (for example to a plug strip)can generate big transients that couple into unshielded electronics and can cause code upset. Since a DC supply to the MCU could stay valid for even up to a second or more after AC OFF these transients can upset the MCU code and cause it to restart several times as the AC is cut off. In your particular case these transients could be disrupting the JMP $ and making evil things happen in the code executing inside the MCU. As a simple check you could try "turning off" the MCU setup by opening the DC line from the supply instead of the AC switch. Use a good switch though because if you unplug a banana jack or take a wire out of a binding post you could glitch the power in a way to make the MCU restart several times too. Michael Karas |