And how do we get this counter to equal .250 seconds? Have it overflow 3 times and you only have .196608 seconds. Loop it 4 times and you have .262144 seconds. You would need count about 3.8147 times. If you look for an exact timer count AFTER you have loop 3 times, you may get closer but still not get exactly .250 seconds every time. Picking a frequency other than 4 MHz (such as 3.2768 MHz) will make it easier to loop an exact number of times to get an exact time of delay. Examples: 3.2768 MHz with prescaler of 32 = .010 sec interupts. 25 loops = .250 seconds 3.2768 MHz with prescaler of 16 = .005 sec interupts. 50 loops = .250 seconds 4.0960 MHz with prescaler of 4 = .001 sec interrupts. 250 loops = .250 seconds In fact, watch crystals use a frequency of 32.768 kHz for the reason of timing. Mark Bishop wrote: > Just have a counter in the interrupt routine that won't act until you get to > .250 > > -----Original Message----- > From: David Dunn [mailto:ddunn@TCAINTERNET.COM] > Sent: Monday, June 11, 2001 10:56 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: timers > > 16F877 chip @ 4 Mhz > > i'm considering using the timers in a project .. what i'd like is an > interrupt every .250 seconds > > i'm already using timer2 for PWM > i'd *like* to use timer1 for a counter > > somebody check my math for me please : > > timer0 runs at 1 Mhz (Fosc/4) .. > > most prescale you can get is 256 .. > > 8 bit counter .. > > working all this out, the *slowest* i can get timer0 to run (on my > calculator) is .065536 seconds > > is this right ? > > thanks, > > david dunn > > -- > 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: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads