ON INTERRUPT needs to be before start.
Code:
TRISB = %10000000
INTCON = %11000000
PIE1 = %00000001
TMR1L = %11011100
TMR1H = %00001011
T1CON = %00110001
PIR1.0 = 0
overflow var Byte
On Interrupt goto blink ' enable interrupt checking in start
start:
If PORTB.7 = 1 Then
PORTB.5 = 1
Else
PORTB.5 = 0
Endif
Goto start
disable ' disable interrupt checking below
blink:
overflow = overflow + 1
If overflow = 20 Then
overflow = 0
If PORTB.1 = 0 Then
PORTB.1 = 1 'Turn on LED
Else
PORTB.1 = 0 'Turn off LED
Endif
Endif
TMR1L = %11011100
TMR1H = %00001011
PIR1.0 = 0
Resume
enable
END
Bookmarks