On Dec 7, 2008, at 2:43 PM, solarwind wrote: > I do not know how to cause an interrupt on a pin change. Dom says you have linux experience. Do you understand how interrupts work in, say, a linux device driver, or on a legacy x86? There's this general problem explaining things to people who have significant experience in some related area but nothing in the area in question. If you word your answers too simply it comes across as insulting or isn't useful, but it's very easy to trip over a line into terms that just aren't part of the questioner's vocabulary (the whole "mil" thing being a fine example.) In microcontrollers, this usually shows up when someone has a lot of electronics background but has never done software, or a lot of software background but has never done electronics. I run into it frquently, trying to find books on windows programming for someone with a lot of experience in CLI and embedded software. So in order to do something with interrupts in general, you need to: 1) Set up some code that is executed when the interrupt occurs (The "Interrupt Service Routine" or ISR) 2) configure the Interrupt Controller and/or interrupt vector table so that the desired interrupt or hardware signal will cause a jump/call to the ISR code. 3) configure the device that is supposed to generate the interrupt appropriately. 4) globally enable interrupts at the CPU level. In your sample snippet of code, you did (3) without doing any of the other things. It actually raised an interesting question for me (I've never used change pin interrupts): does IoC configured on a port cause the PIC to wake up from sleep even if higher levels of interrupt control aren't enabled? It seems like it should, but then if it did I would think your code would work. Some CPUs return to sleep mode when they're done executing the ISR, if they were in sleep mode when the interrupt occurred. I don't recall whether the PIC is one of them. Sometimes this is a consequence of sleep status being part of the "status register" that an interrupt saves automatically. If so, part of the ISR has to be explicitly change the status register or sleep status before returning. BillW -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist