I'm switching from a 12F629 to a 16F676 to get more pins and trying to work out the differences in the pics. The following is supposed to use a falling edge Port Change Interupt on Pin 2. The program Blinks an LED at power up and is supposed to blink it 5 times at interupt. It blinks at power up but does not interupt. I had all of it worked out for the 629 and am sure there is something small I'm missing, but I can't seem to find it. Any help would be appriciated.
@ DEVICE PIC16F676,INTRC_OSC_NOCLKOUT,WDT_ON,PWRT_OFF,BOD_O FF,PROTECT_OFF,CPD_OFF,MCLR_OFF
ANSEL = 0 ' DISABLE THE ANALOG INPUT
CMCON = 7 ' DISABLE COMPARATOR ON PORTA
VRCON = 0 ' A/D Voltage reference disabled
TRISA = %00111110
WPUA = %00110110
SYMBOL TRIG = PORTA.5
SYMBOL LED = PORTA.0
I VAR WORD
INTCON = %10000000
IOCA = %00100000
OPTION_REG = %00001000
OUTPUT PORTA.0
LOW LED
PAUSE 1000
HIGH LED
GOTO BASE
MYINT:
INTCON = %10000000
ILOOP:
I = I + 1
IF I = 5 THEN
GOTO BASE
ENDIF
GOTO ILOOP
LOW LED
PAUSE 1000
IF TRIG = 0 THEN
ENDIF
GOTO ILOOP
BASE:
I = 0
ON INTERRUPT GOTO MYINT:
INTCON = %10001000
LOOP:
SLEEP 240
GOTO LOOP
Bookmarks