PDA

View Full Version : Hersin timeout



andybarrett1
- 17th April 2015, 13:52
Hi All

Am using HERSIN with a timeout... My question is :-

What is the longest timeout I can use.... As I want to use this to put the device to sleep if no input on RX pin after X mins.

The manual only states milliseconds so 1000 = 1 second.

Maybe just try it and see ?

BR
Andy

Dave
- 17th April 2015, 14:35
I believe the maximum variable size is 65535.

andybarrett1
- 17th April 2015, 14:59
Hi Dave

I knew that :-) Honest !

Thank you.

Art
- 7th May 2015, 11:19
1 second is a nice even value,



timeoutperiod var word

...

HSERIN [Item... timeoutjump,1000] ; 1 second timeout
resumeprogram:


straight after the code that validates the actual input data


timeoutperiod = 0; // reset sleep timeout


anywhere in your main loop


if timeoutperiod > 1199 then ; 20 mins with no valid input
goto sleeproutine
endif


way at the end of your program...


timeoutjump:
timeoutperiod = timeoutperiod + 1;
goto resumeprogram