#include CONFIG FOSC = HS ; H oscillator, HS used by USB CONFIG WDT = OFF ; HW disabled - SW Controlled ( deactivation des watchdog timer) CONFIG DEBUG = OFF CONFIG MCLRE = OFF ; CONFIG CPUDIV = OSC1_PLL2 CONFIG PBADEN = OFF counter_value equ H'04' RES_VECTOR CODE 0x0000; goto init org 0x0008 ; interrupt vector at PM address 0x0008 goto irq_handle ; go to the function for the INT0_interrupt bcf INTCON , INT0IF ; clear the flag bsf PORTC, RC0 retfie irq_handle ; --- interrupt routine btfsc INTCON , INT0IF goto INT0_interrupt ; yes , it is TMR0 retfie ; --- no , return from interrupt MAIN_PROG CODE init clrf TRISC ; set PORTC as output clrf PORTC ; clear PORTC setf TRISB ; clrf PORTB ; clear PORTB bsf INTCON , GIE ; activate interrupts bsf INTCON , INT0IE ; activate external interrupt bsf INTCON, INTEDG0 ; interrupt on rising edge goto main_loop main_loop bcf PORTC, RC0; goto main_loop ; push skipped END