I pretty much do what Mark recommends in elsewhere this thread: I have a main do-loop which calls a heap of label: ..return, and sub() ...end sub, and the subs are grouped at the end of the code. My project is similar to what Microboter is doing I think. I am reading data from 3 serial ports from remote devices ( weather, noise, temperature,sms etc using a modem on the cellular network) and of course there are often delays of several minutes on the cellular network, before expected responses, sms, TCPIP responses etc etc come back. This means that my main loop can be scanned in a few mSec or several minutes, depending on external delays.
I cannot have only one 'reset watchdog' in the main loop which is what i would ideally like. So - currently I reset the WD timer in every do-loop or sub where a delay longer than 8 seconds is liable to occur. Thats fine, but it increases the risk of the processor getting stuck in a rogue loop somewhere, and the WD not timing out. I'm seriously thinking of adding a hardware WD (using a 4060 set to say 15min and reset once only in the main loop)
I'm interested if anyone else has a better idea. Incidently - now that I've solved the reset problem I had a few months ago, I get a reset about once every 1 -2 months, and generally when there is a thunderstorm nearby, so I'm guessing emi.
neil
↧