Re: How best to time a pin state for extended periods of time
If Time accuracy is not an issue then a simple routine like this should solve the problem:
Code:
Counter Var WORD
Main:
IF Pin_1 = 0 then
PAUSE 1000 ' one second delay
Counter = Counter + 1
IF Counter >1800 then Output_3 = 1
ENDIF
IF Pin_1 = 1 and Counter > 1 then
IF Counter <= 120 then Output_1 = 1
IF Counter >120 and Conter <= 1200 then Outpt_2 = 1
IF Counter >1200 then Output_3 = 1
Counter = 0
ENDIF
GOTO Main
All the time your Pin_1 will go to zero the time check will be activated.
Cheers
Al.
Last edited by aratti; - 10th March 2011 at 06:48.
All progress began with an idea
Bookmarks