[quote:aac4499212="albertsm"]which processor do you use?
did you checked the PCINT_CHANGE.bas sample from the samples folder?[/quote:aac4499212]
I am using ATMEGA164P
PCINT2 is PORTA, PIN 2, PA2
I went through the sample, here is the code I have written. I do not see any print output from ISR
[code:1:aac4499212]$regfile = "M164pdef.dat"
$crystal = 14745600 'this freq give 0.0% error for all baud rates up to 115200
$baud = 57600
Config Porta = Input
Porta = &HF 'activate pull up
Enable Interrupts 'enable global ints
Enable Pcint2 'we enable pcint0 as this has pcint0-pcint7
On Pcint2 Isr_pcint 'we jump to this label when one of the pins is changed
Pcmsk0 = &B00000100
Do
Loop
Isr_pcint:
Print "Pin change " ; Bin(pcmsk0) ; Spc(3) ; Bin(pina)
'As you see the mask does not change, so to find out which pin changed,
'you need to read the PINB register.
Return
End[/code:1:aac4499212]
↧