
Originally Posted by
Bruce
I would read the port as fast as possible (immediately on interrupt) by saving it in an 8-bit
variable, and then testing for the port bit in question stored in my variable.
MyPort VAR BYTE. MyPort=PORTA. Now test bits in MyPort for the change.
Edit:
The only interrupt flags available are those shown in the data sheet.
That's exactly what I'm doing (see my code below) but I have the feeling it makes me waste some time doing all the stuff only to know which pin triggered the int
Code:
DISABLE 'disable individual interrupts while executing the interrupt routine (do not put check interrupts calls after each instruction)
in_sig:
'MEMO: first read the port THEN clear the flag otherwise mismatch still exists
'Contribution from: Darrel Taylor (www.picbasic.co.uk/forum/)
a = porta 'read port to clear mismatch
'TEST block
HIGH portc.2
'check what pin triggered the int
'we have the time of the header pulse to manage that work
if (a.0(0) == 0) THEN
pin = 0
GOTO got_pin 'bypass
ENDIF
if (a.0(1) == 0) THEN
pin = 1
GOTO got_pin 'bypass
ENDIF
if (a.0(2) == 0) THEN
pin = 2
GOTO got_pin 'bypass
ENDIF
if (a.0(3) == 0) THEN
pin = 3
GOTO got_pin 'bypass
ENDIF
if (a.0(4) == 0) THEN
pin = 4
GOTO got_pin 'bypass
ENDIF
got_pin:
This works, then I have to use porta.0(pin).
Bookmarks