This is a long term timing application, the resolution is 60 minutes, and would expect it to be in service for years, possibly having a count every 200us might lead to a too large number.. --dave -----Original Message----- From: Ariel Rocholl [mailto:foros@arocholl.com] Sent: 11 April 2008 16:03 To: Microcontroller discussion list - Public. Subject: Re: [PIC] Measuring time a DC signal is on Depending on how long that measure can be (seconds? days? years?), you will need: * A timer (better 16bit one than 8bit one, you can choose depending on it not being already allocated for a peripheral). Take a look on the datasheet, it is straightforward to enable a timer. * A timer interrupt, to increment a global variable that will count how many times the timer carried over. * A global variable. Let's say that depending on your timer, OSC frequency and pre/postcaler, you have an interrupt every 200uS. The variable will increment once every 200uS so depending on how many of these ticks you need to count, this may go to a 32bits or even 64bits variable. 2008/4/11, Dave Roseman : > Hi, > > > > I am using a PIC16F690 to monitor how long a power supply is active for, but > I have no idea how to use the timer in the micro to monitor this signal. It > does go high when the power is on, but how to get this info to the micro, I > don't know. > > > > Also, this reading is required to be cumulative, so has to remember the > previous on time and append to it. > > > > I'm just starting PIC programming, so please forgive me if this is too > simple or obvious a question. > > > > Regards > > Dave Roseman > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- Ariel Rocholl Madrid, Spain -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist