If variable from 1-300, and assuming that that means integers, I'd say use TMR0 and divide accordingly in the ISR to get 1-sec pulses. Then maintain 2 counters -- one set to 26 and the other to 35. On every 1-sec pulse, decrement counter A and perform whatever action when it hits 0. Also reset it to 26. ALSO, on the same 1-sec pulses, do the same for counter B and reset to 35 when it hits 0 and you perform the necessary actions. Can't say how this would work using the WDT, but I don't feel that it was designed for this purpose, where as TMR0 etc was. Cheers, -Neil. -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Adam Smith Sent: Tuesday, June 11, 2002 2:16 PM To: PICLIST@MITVMA.MIT.EDU Subject: [PIC]: Multitasking and timing 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