Hi,
here is a simple Interrupt On Change program, that turns on a led on portC for pic16f684, it cost me a week to find this answer, I only hope that this help to solve problems easier for others...
[code]'configuración
ANSEL = 0 'I/O digitals
OPTION_REG = 7 'Enable pullups
IOCA.0 = 1 'Enable Interrupt on Change for RA0
WPUA.0 = 1 'Enable pull up RA0
TRISC = 0 'portC output
TRISA = 7 'portA <2:0> input <5:3> output
INTCON.0 = 0 'clear IOC flag
INTCON.3 = 1 'Enable IOC interrupt
INTCON.7 = 1 'Enagle GIE
'variables
I var byte 'missmatch variable for IOC
inicio:
if INTCON.0 = 1 THEN 'Change on portA ocurred?
PORTC.5 = 1 'turn On led
pause 500 'wait half second
PORTC.5 = 0 'turn On led
I = PORTA 'end missmatch
INTCON.0 = 0 'clear IOC flag for next interrupt
ELSE 'if no change is ocurred
PORTC.5 = 0 'led continues off
ENDIF '
GOTO inicio 'loop[\code]
PS. Sorry for my English. I can't make my code seccion work
Regards,
Luis Lugo
Bookmarks