I have recently started using the 18M2 but have had instability problems with it in that it appears to be constantly resetting itself. I have reduced my test circuit down to a single 1k resistor & LED on pin c.0 and the standard 10k/22k programming resistors. I've also placed a 0.1uF capacitor across the power supply pins.
I've loaded the following program which simply outputs a message, flashes the LED 5 times and then ends.
Initially, I found when operating this circuit from a switch mode 12 volt supply that was well filtered and reduced to 5 volts via a 7805, that touching the Serial In pin (C.4) with my finger, caused the program to restart. This was solved by the Disconnect command but I wondered why I needed it. In fact, I found all the input pins needed a resistance to ground of less than 10k to keep them low. All of these problems disapeared if I operated the circuit from 4 rechargable batteries or if I earthed the negative supply from the switch mode supply - but again, I'm not sure why I need to do this and its not always convenient to have an earth connection.
However, I now find that even when I operate this circuit from a battery, the circuit resets itself every 2602 seconds. It does this even if the programming cable is removed (ie I see the LEDs flash every 2602 seconds) so it isn't being reset by the programming cable.
If the program is changed slightly by replacing the "end" statement with a "endf: sleep 1: goto endf" statement, it still resets but now at intervals of 235 seconds. By changing the sleep interval variable to "sleep 100", the reset interval changed to 267 seconds. However if I replace the sleep command with a pause command (ie "endf: pause 2300: goto endf"), the resetting doesn't seem to occur (or if it does its interval is longer than 24 hours).
I've repeated the above with 2 different 18M2's and got similar results from each. As a sanity check, I also ran the equivalent code on an 08M and as expected it didn't reset.
What's going on? I must be doing something wrong because I can't see any reference to anyone else having these re-setting problems with the 18M2 but its not obvious to me what.
Thanks
Bill
I've loaded the following program which simply outputs a message, flashes the LED 5 times and then ends.
Code:
#picaxe 18m2
#no_data
sertxd ("Started Flash",cr,lf)
for b0=1 to 10
toggle c.0
pause 500
next b0
end
'endf: sleep 1: goto endf
However, I now find that even when I operate this circuit from a battery, the circuit resets itself every 2602 seconds. It does this even if the programming cable is removed (ie I see the LEDs flash every 2602 seconds) so it isn't being reset by the programming cable.
If the program is changed slightly by replacing the "end" statement with a "endf: sleep 1: goto endf" statement, it still resets but now at intervals of 235 seconds. By changing the sleep interval variable to "sleep 100", the reset interval changed to 267 seconds. However if I replace the sleep command with a pause command (ie "endf: pause 2300: goto endf"), the resetting doesn't seem to occur (or if it does its interval is longer than 24 hours).
I've repeated the above with 2 different 18M2's and got similar results from each. As a sanity check, I also ran the equivalent code on an 08M and as expected it didn't reset.
What's going on? I must be doing something wrong because I can't see any reference to anyone else having these re-setting problems with the 18M2 but its not obvious to me what.
Thanks
Bill