Datasheet

Programming PIC Microcontrollers in BASIC - mikroElektronika
Here is a simple example:
In the main loop, program keeps LED_run diode on and LED_int diode off. Pressing the button T causes the interrupt –
microcontroller stops executing the main program and starts the interrupt procedure.
program testinterrupt
symbol LED_run = PORTB.7 ' LED_run is connected to PORTB pin
7
symbol LED_int = PORTB.6 ' LED_int is connected to PORTB pin
6
sub procedure interrupt ' Interrupt service routine
if INTCON.RBIF = 1 then ' Changes on RB4-RB7 ?
INTCON.RBIF = 0
else if INTCON.INTF = 1 then ' External interupt (RB0 pin) ?
LED_run = 0
LED_int = 1
Delay_ms(500)
INTCON.INTF = 0
else if INTCON.T0IF = 1 then ' TMR0 interrupt occurred ?
INTCON.T0IF = 0
else if INTCON.EEIF = 1 then ' Is EEPROM write cycle finished ?
INTCON.EEIF = 0
end if
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/06.htm (2 sur 12)05/11/2004 02:26:24