;******************************************************** ;Int_Demo1 ;This program demonstrates simple interrupts. ;Intended for simulation. ;tjw rev.14.2.09 Tested in simulation 14.9.09 ;******************************************************** ; include p16f84A.inc ;Port A all output ;Port B: bit 0 = Interrupt Input ; org 00 goto start ; org 04 ;here if interrupt occurs goto Int_Routine ; org 0010 ;Initialise start bsf status,rp0 ;select bank 1 movlw 01 movwf trisb ;portb bits 1-7 output, ; bit 0 is input movlw 00 movwf trisa ;porta bits all output ;Comment in or out following instruction to change ;interrupt edge bcf option_reg,intedg bcf status,rp0 ;select bank 0 bsf intcon,inte ;enable external interrupt bsf intcon,gie ;enable global int wait movlw 0a ;set up initial port output values movwf porta nop movlw 15 movwf porta goto wait ; org 0080 Int_Routine movlw 00 movwf porta bcf intcon,intf ;clear the interrupt flag retfie end