serin... no answer?

RickAlty

Senior Member
Is there any way for a picaxe to wait a short time for a serin stream, and if it doesn't get it, go back to what it was doing?

I'm thinking of...

serout ("ready")
serin #b1
pause 100
if #b1 <> "" then something
something else:

Is there any way to do this, or does a picaxe invariably just sit for ever if it reaches a serin but gets no data?

Richard
 

BeanieBots

Moderator
Worth doing a forum search. There have been many topics about this. The most popular solution is to use interupts to detect the incoming serial signal and only then enter into the serin command when you "know" something is about to arrive.
Another approach is to use a whatchdog. If not kicked, it can supply a diode or'd serial to the receiver and/or reset it.
 

moxhamj

New Member
Serin hangs the pic. The number of posts on the serin problem shows it is something that needs fixing if this is possible. Example - I use a PC to turn on pics that control sprinklers and pumps and lights around the house. If the PC crashes, the sprinklers etc won't turn off. Solution is to have a missing pulse detector circuit. A 555 will do this, and is reset every minute by the pic whenever serin arrives. The 555 stays high as long as pulses keep arriving. The output is "anded" with the pic output. Other RC circuits are possible. One can also use a 555 to power the pic, and hence restart it periodically. A timeout on serin would save at least 4 extra components.
 
Top