Hi Henrik
As you can see, if an interrupt occurs in the middle of a Pause it won't get serviced until the Pause statement has finished so if you're using PBP's ON INTERRUPT you need be aware of this.
Very interesting that because I built a little test circuit based on mackrackit's code using a PIC12F683 (program below) with the INTERRUPT toggling an LED on GPIO.4 The MAIN code turned an LED on and off you've guest it using pause statements!
I was expecting the INTERRUPT LED (GPIO.4) to blink really quickly and the LED on GPIO.0 to blink at 500 mili_secs much slower, in reality they were much the same speed.
The manual refers to this as (latency). Like you say it pays to be aware of it. You wouldn't want an interrupt acting as an emergency stop when combined with a long pause statement.....Ouch!
Code:
ANSEL = %00000000
CMCON0 = %00000111
TRISIO = %11101110
GPIO = %00000001
INTCON.5 = 1 'ENABLE TMR0
OPTION_REG = %10000101 '16BIT 1:64 PRESCALE
ON INTERRUPT GOTO TLOOP
MAINLOOP:
PAUSE 500
low GPIO.0
PAUSE 500
high GPIO.0
GOTO MAINLOOP
DISABLE
TLOOP:
INTCON.2=0:TOGGLE GPIO.4
RESUME: ENABLE
Bookmarks