solarwind wrote: > On Sun, Dec 7, 2008 at 12:05 PM, Robert Kiely wrote: >> Just glanced at the code there and first thing off is you need enable >> interrupts by setting the relevant bits in the INTCON register or an >> interrupt will never be caught so your code will just get to the sleep >> part and stay there. You also need to clear the relevant bit of the >> ANSEL register to set the input to digital for the push button. Inputs >> default to analogue on power-up. This can be seen on page 98 of the >> datasheet in the A/D converter section. Above each bit it says R/W - >> *1*, this mean it defaults to 1. Also you have no interrupt function >> or ISR as it's called. When an interrupt does occur code execution >> will jump to the interrupt vector and needs to be handled from there, >> at a minimum you need to clear the interrupt flag to prevent an >> infinite loop of interrupts. You say you looked at the datasheet but >> it seems you didn't. Getting started can be hard but there are *so* >> many examples out there on the net just ask Uncle Google and he'll >> sort you out. Hope this help somewhat... oh and if you search the list >> archives on the 23 Nov this year you will get my post about timer0 >> interrupts which should help shed some light and how interrupts work. > > I don't know how to do this. Exactly what part of the above does "this" refer to ?? > The data sheet doesn't explain anything either. I'd say it does, in it's own way of explaining things... -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist