This is basically an example of what John/JEC first mentioned above. Enjoy.Code:PulseInput var PortB.0 ' Pin is HIGH with Pulse taking it LOW ButtonInput var PortB.1 ' Pin is HIGH with Button Press taking it Low LED var PortB.2 ' LED will Light when all Conditions Met CounterA var Byte ' Just a variable to Count 20 Seconds TRISB=%00000011 ' Setup Port I/O LOW LED ' LED is OFF Pause 500 ' Settling Timeout of 500mS StartLoop: While PulseInput=1:Wend ' Wait for Pulse Here CounterA=0 ' Reset 20 seconds Counter TimerLoop: while ButtonInput=1 ' Loop waits for Button-Press CounterA=CounterA+1 ' Increment Counter every 100mS If CounterA=200 then StartLoop ' Redo from Start if 20 seconds elapsed Pause 100 ' Kill 100mS wend MainCodeSuccess: High LED ' Light LED Pause 5000 ' for 5 Seconds Low LED Goto StartLoop ' And start over again End
Bookmarks