Jellis
Can you try it this way ? What I'm suggesting is to clear the mismatch, enable the mismatch interrupt and then sleep
Code:
IOCA = %00001000 ' Enable RA3 as on-change-INT ***this could be made permanent before main***
' clear the mismatch condition
dummy = flush
INTCON = %10001000 ' Enable interrupts: global & RABIE, but TMR0 disabled ** and RABIF is cleared **
@ sleep
' Microcontroller is in Sleep State waiting for external FLUSH Interrupt
' Valve should be closed at this point and no water flowing
GOTO Main ' Loop to Main to wait for next Flush interrupt on RA3 change
Bookmarks