> I am still trying to get this timer code working. Thanks to those > that helped last time. I have gone over the datasheet again, but > still don't understand how the three bits PS0:PS2 set the prescaler > value. Could someone please explain this too me? I'll have a go. Page 9 of the data sheet is useful. It would have been logical if this table appeared in the timer section of the data sheet as well, but it doesn't. To use the prescaler you need only be concerned with bits PSA, PS2, PS1, and PS0. (PS means PreScaler not PlayStation!). First you tell it you want the prescaler to work on the timer, so you clear bit PSA (PSA = 0). The prescaler can be considered a divider that divides the number of clock pulses into the timer so you can make it count slower. The 3 bits PS2:PS0 set the amount of division. There are 8 division ratios to choose from ranging from 1:2 when PS2=0, PS1=0, PS0=0 up to 1:256 when PS2=1, PS1=1, PS0=1. The table makes this easy to follow:- 000 1 : 2 001 1 : 4 010 1 : 8 011 1 : 16 100 1 : 32 101 1 : 64 110 1 : 128 111 1 : 256 For example, with PS2:PS0 set to 101 the timer will increment by one every 64th clock pulse. If in timer mode (T0CS=0) the clock pulse will be the oscillator frequency divided by 4 (this is 1 instruction cycle). Total division would then be 64 x 4 = 256, so for example with a 4MHz crystal the timer would run at 15.625kHz. In counter mode (T0CS=1) the clock pulse comes from an external signal (RA4/T0CKI). Remember that you can use the prescaler for Timer0 or for the Watchdog timer, but not for both at the same time. Bit PSA selects which is assigned. Hope this helps a bit. Brent Brown Electronic Design Solutions 16 English Street Hamilton, New Zealand Ph/fax: +64 7 849 0069 Mobile/text: 025 334 069 eMail: brent.brown@clear.net.nz -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.