If I was doing same thing I'll set outputs as needed on start of event 9 or 11...
To detect start of event "9" and "11" you can use this code:
Code:
IF TableIn=9 AND TableInLast<>9 THEN
'Here you can do what ever needed
ELSEIF TableIn=11 AND TableInLast<>11 THEN
'Sttuf for event 11
ENDIF
TableInLast=TableIn
This way if you have continuous 9 or 11 on input, PIC won't be bricked doing pause...
PAUSE 2000 will block pic to respond to other input states for 2 seconds. I don't know if that can cause problem... But there is way to make timings without using pauses.
First set outputs, and then start timer. And on timer interrupt you turn off timer, and set outputs to default state...
That is pretty easy using DTINT.
Bookmarks