list p=18f4550
#include p18f4550.inc
config FOSC=INTOSC_EC
config WDT=OFF
;===========jump to main=============
org 0h
goto main
;===========jump into ISR============
org 8h
goto isr
;============main program============
org 100h
main
bcf TRISD,0 ;led
bsf TRISB,INT0 ;switch
bsf INTCON,GIE ;global interrupt enable
bsf INTCON,INT0IE ;RB0 interrupt enable
bra $
;===================ISR==============
org 200h
isr
btfss INTCON,INT0IF ;ckeck for interrupt
retfie ;if no then return
btg LATD,0 ;toggle led
bcf INTCON,INT0IF ;clean interrupt flag
retfie
end