I building a data logger and I basically want to have the PIC automatically running all the time, but after periods of inactivity have it go into a Sleep or Idle state. Coming out of Idle or Sleep would be accomplished by the use of Interrupts, but I'm having a little difficulty in figuring out how to actually detect a period of inactivity? I was thinking about after a function completes have it jump to a sub which would count a specified amount of time and then enter the sleep state, however at the same time I need to poll a number of pins for a change (can't use interrupts for all of them I don't think). I'm not expecting anybody to provide full source code, but if anybody has a link to anything describe theory or ideas to do this it would be greatly appreciated. I know there is probably a better way to do it then anything I thought of. Thanks in advance.