timeout doesn't work

hax

New Member
Hi all,
It's been a long time since I've posted on the forum!
I've just picked up a 08M2 for the specific feature of it having a serial timeout but it does not seem to be working for me.

Here is a simple program:

main:
serin [1000,continue],3,N600,("ll"),b1
goto main

continue:
debug
goto main



The way I read the command in the manual is that in the above example, if no serial string is received, after 100ms the program will jump to the debug statement..... but it doesn't work, no debug occurs. Why?
 

hippy

Senior Member
It works for me, though a timeout of 1000 is one second. In what way does it not work for you ? And where is your input coming from; particularly is it a 433MHz module or similar ?

For detecting timeout events ( or lack of ) it's better to use SERTXD than DEBUG because it's much easier to see what is happening than rely on the debug received count in the title bar.

#Terminal 4800
main:
serin [1000,continue],3,N600,("ll"),b1
sertxd(" Got data = ", #b1, CR, LF )
goto main

continue:
sertxd( "timedout", CR, LF )
goto main
 

Technical

Technical Support
Staff member
As you are using pin 3 do you have the external diode to V+, you can sometimes get strange behaviour without it.
 

hax

New Member
It is a 433Mhz module..... Is that a problem?

I'm reading between the lines, and guessing that the command won't time out if there is spurious highs and lows on the serin pin?
 

Technical

Technical Support
Staff member
Correct, you will be getting continuous rf noise spikes which keep resetting the timeout, so it never times out.
Use an NKM2401, or use a 14M2 and the rfin command!
 

hax

New Member
Ah, just looked at the RFIN command, and it also doesn't have a timeout.... so I'll have to use the NKM2401...
 

zebulon

Member
Hi,

You can also insert another 08M2 or 08M - or whatever you want - between your PICAXE and the RF input just to handle the communication. That's what I do and it work fine for me and this is a cheap and simple solution when the PICAXE you use isn't rfin compatible.

An example of code to put in the inserted PICAXE :
Code:
#picaxe 08M

symbol in_serie_HF = 1 ' Connection de la pin data du module HF sur le port 1 du 08M (pin 6)

symbol out_serie_filaire = 2 ' Connection du port 2 du 08M (pin 5)


debut:

	serin in_serie_HF, N2400_4, ("qualifier"), B0
	serout out_serie_filaire, N2400_4, ("qualifier", B0)

goto debut
Guillaume
 
Top