Adam, your problem is easy because is dealing with wery slow events Use your tmr0 to generate one second event as Roman show in: http://www.ezy.net.au/~fastvid/one_sec.htm if you need precisely events ( exactly at 26 and 36 seconds ) Let the second counter from isr routine to work as free counter. In the main loop reset the second counter then increment it untill the 26'th second. Compare your counter with a constant ( 26 ) and run your event, then compare your counter with 35 and run the other event, then reset the counter. It's a less then 100 lines JAL program. And work very precisely. regards, Vasile http://www.geocities.com/vsurducan On Tue, 11 Jun 2002, Adam Smith wrote: > Hello, > > I am trying to make a PIC16LF872 do multiple things at variable > intervals. > > Let's suppose that I have eventA and eventB. I want eventA to occur (it > could be making an output pin high, calling a procedure, whatever...) > every 26 seconds and eventB to occur every 35 seconds. How do you guys > suggest I do this? > > I want the PIC to be asleep when the events are not being fired. Also, > the times given above (26 and 35 seconds) are just for illustration, > these will be variable from 1-300 seconds. > > I was thinking of using the WDT with the prescaler and use some > computations to add a postscaler in accordance to the requirements, but > given the inaccuracy of the WDT (7-33 ms) it isn't very feasible. > > Given the incredibly fast advancement of the timers (even with a > prescaler), this option doesn't sound very appealing either. (The chip > will be running on a 4MHz clock.) > > The only reasonable option I've come up with is a 555 timer giving me a > 1Hz pulse to count off of. The big downfall here is the power > consumption. Not only will this be running off of 4 AA batteries, these > periodic events will be occurring 24 hours a day. > > Any suggestions? > > Thanks, > Adam Smith > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics