I have written this short piece of code to test the interrupt. IT Works! but only ONCE... For some reason it will not interrupt the second time unless I reset the processor with the power. I can't see a problem. I am resetting INTCON before return to main program. ???
[Code:@ DEVICE PIC12F683,MCLR_OFF,INTRC_OSC_NOCLKOUT ,WDT_ON,BOD_OFF @ DEVICE PWRT_ON,FCMEN_OFF,IESO_OFF,PROTECT_OFF OSCCON=%1110000 Define OSC 8 VRCON = 0 ADCON0 = 0 OPTION_REG = %01000000 ;rising edge ANSEL = 0 ;digital all CMCON0= 7 INTCON = %10010000 ;GlE set, INTE set, INTF clr GPIO=0 TRISIO = %00001100 ;GPIO.2 input Avar var byte Blink var GPIO.4 TX var GPIO.5 GOTO Main define INTHAND myint asm myint goto _printlog endasm Main: Blinkled: pause 1000 for Avar=1 to 4 HIGH blink pause 100 low blink pause 200 next Avar Serout2 tx, 84, [" This is a test, This is only a test",13,10,13,10] ;print to PC goto Blinkled printlog: Serout2 tx, 84, [" An Interrupt has occured on GP2",13,10,13,10] INTCON=%10010000 ;set GIE, INTE and clear INTF goto Main end




Bookmarks