Hi, After much reading up, I found some registers related to timer1. Using my earlier (and finally successful) RS232 program, I tried to send the contents of TMR1 every time a button is pressed. When I tried to send TMR1H (most significant byte), it was always d'8', and the least significant byte was always changed around, starting at 85, then after a few resets, 86, then 87, and finally 83. I setup T1CON with: 00001011 and later tried 00001111 That's: system clock not running off tmr1, no prescaler (1:1), osc enabled, I tried syncing on and off - no change, tmr1 source is external, and tmr1 is on. On 5/8/05, Olin Lathrop wrote: > Dave Turner wrote: > > Firstly, I'm not running off battery power. After much fiddling with > > config bits I have discovered that with the PIC running on XT mode, it > > runs a lot faster than it should if it is using the 32.768KHz clock. > > Also, on INTRC mode it runs too fast. On EXTRC, LP or HS mode it > > doesn't run at all. > > Sounds like general confusion about the system oscillator. Get this figured > out first, because everything else mostly depends on it. If you're not > running on battery power, why not run the PIC at its maximum clock speed of > 20MHz? All you need is a 20MHz crystal specified for parallel operation and > two caps around 22pF, with the oscillator set to HS mode. > > If the issues is pins or board space, then the internal oscillator is a good > choice. You can use it to run the PIC, and the timer 1 oscillator for > accurate timing. > > > The reason I'm trying to use the 32.768KHz clock as the system clock > > is that I don't have a clue how to make a delay by checking a clock - > > The only method I know is many embedded loops. > > Fix this first. Since you're willing to have a crystal anyway, I would make > is a 20MHz crystal on the main oscillator. Once you've done that, it's very > easy to set up a periodic interrupt of 1mS, for example, using timer 2 and > its period register. This would happen once every 5000 instructions, so > doesn't add much load to the processor. As long as 1mS is close enough > timing for everything else in the system, this will work fine. > > Once you've got that, there are many ways to implement timers for longer > periods. One way is to have a counter for each delay event you need. To > wait, you set the counter to the number of mS to wait. The interrupt > routine decrements the counter whenever it's not zero, and sets a flag when > it decrements it from 1 to 0. Now the foreground code can go off and do > other things, and the flag becomes just another event to handle in the main > event loop. > > That's only one of many ways to do this. > > > ***************************************************************** > Embed Inc, embedded system specialists in Littleton Massachusetts > (978) 742-9014, http://www.embedinc.com > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist