The 8051 comes equipped with two timers, both of which may be controlled, set, read, and configured individually. The 8051 timers have three general functions:
(1) Keeping time and/or calculating the amount of time between events,
(2) Counting the events themselves, or
(3) Generating baud rates for the serial port.
A timer always counts up. It doesn’t matter whether the timer is being used as a timer, a counter, or a baud rate generator: A timer is always incremented by the microcontroller.In 8051, there are four modes of operations of timers.
(i) 13-bit Time Mode (mode 0)
Timer mode "0" is a 13-bit timer. This is a relic that was kept around in the 8051 to maintain compatibility with its predecessor, the 8048. Generally the 13-bit timer mode is not used in new development. When the timer is in 13-bit mode, TLx will count from 0 to 31. When TLx is incremented from 31, it will "reset" to 0 and increment THx. Thus, effectively, only 13 bits of the two timer bytes are being used: bits 0-4 of TLx and bits 0-7 of THx. This also means, in essence, the timer can only contain 8192 values. If we set a 13-bit timer to 0, it will overflow back to zero 8192 machine cycles later.
(ii) 16-bit Time Mode (mode 1)
Timer mode "1" is a 16-bit timer. This is a very commonly used mode. It functions just like 13-bit mode except that all 16 bits are used. TLx is incremented from 0 to 255. When TLx is incremented from 255, it resets to 0 and causes THx to be incremented by 1. Since this is a full 16-bit timer, the timer may contain up to 65536 distinct values. If we set a 16-bit timer to 0, it will overflow back to 0 after 65,536 machine cycles.
(iii) 8-bit Time Mode (mode 2)
Timer mode "2" is an 8-bit auto-reload mode. When a timer is in mode 2, THx holds the "reload value" and TLx is the timer itself. Thus, TLx starts counting up. When TLx reaches 255 and is subsequently incremented, instead of resetting to 0 (as in the case of modes 0 and 1), it will be reset to the value stored in THx.
(iv) Split Timer Mode (mode 3)
Timer mode "3" is a split-timer mode. When Timer 0 is placed in mode 3, it essentially becomes two separate 8-bit timers. That is to say, Timer 0 is TL0 and Timer 1 is TH0. Both timers count from 0 to 255 and overflow back to 0. All the bits that are related to Timer 1 will now be tied to TH0.
While Timer 0 is in split mode, the real Timer 1 (i.e. TH1 and TL1) can be put into modes 0, 1 or 2 normally--however, we may not start or stop the real timer 1 since the bits that do that are now linked to TH0. The real timer 1, in this case, will be incremented every machine cycle no matter what.
The only real use of using split timer mode is if we need to have two separate timers and, additionally, a baud rate generator. In such case we can use the real Timer 1 as a baud rate generator and use TH0/TL0 as two separate timers.
BACK to Content Page
Tags:- john adc0804 to 8051 micro program with assembly language,the program of 8051 to the pulse,8051 and i2c interface,8051 microcontroller,USING TIMERS AS EVENT COUNTERS,assembly code of 89c51 for temperature monitoring8051 Timer/Counter Mode 0, like mode 1, except that it's 13-bit timer/counter , Microcontrollers 8051 : Counters & Timers | Classle,8051-8052 Timers - Free 8051 Microcontroller projects,8051 Timer/Counter Setup the timer 0, mode 2 -- 8-bit timer auto-reload, internal timers/counters of 8051,Timers /Counters Programming. The 8051 has 2 timers/counters: timer/counter 0; timer/counter 1,Timers T0 and T1. The AT89S8253 has three timers/counters marked as T0, T1 and T2. Timers T0 and T1 completely fall under the 8051 Standard,The basic 8051 has two on-chip timers that can be used for timing ,8051 Counter 0 Example Program,8051 Timer and Counters,If you wish the timer to be an event counter you set the corresponding C/T-bar bit,How Timers Count - 8051 Timers - 8051 Microcontroller Timers ,How Timers Count - 8051 Timers - 8051 Microcontroller Timers, PROGRAMMING TIMERS 0 AND 1 IN 8051 C,Counter/timer hardware is a crucial component of most embedded systems. In some cases a timer is needed to measure elapsed time countdown timer,555 timer,timer download,timer software,virtual timer,timer java,
timer c#,timer as3,counter strike,countdown counter,web counter,stat counter,blog counter,counter strike download,hit counter,synchronous counter,Design Project: data acquisition system using 8051 Event counter Compute combinations, permutations, factorials; data acquisition system using 8051 and count events,using 8051 counter