UMBC CMSC 391 -- Programming Microcontrollers  


8051 Timer Mode Control (TMOD) Special Function Register

Bit TMOD Bit Function
7 Gate -- OR gate enable bit which controls RUN/STOP of timer 1. Set to 1 by program to enable timer to run if bit TR1 in TCON is set and signal on external interrupt INT1 is high. Cleared to 0 by program to enable time to run if bit TR1 is set.
6 C/T -- Set to 1 by program to make timer 1 act as a counter by counting pulses from external input pins 3.5. Cleared to zero by program to make timer act as a timer by counting internal frequency.
5 M1 -- Timer/counter operating mode select bit 1. Set/cleared by program to select mode.
4 M0 -- Timer/counter operating mode select bit 0. Set/cleared by program to select mode.
3 Gate -- OR gate enable bit which controls RUN/STOP of timer 0. Set to 1 by program to enable timer to run if bit TR0 in TCON is set and signal on external interrupt INT0 is high. Cleared to 0 by program to enable time to run if bit TR0 is set.
2 C/T -- Set to 1 by program to make timer 0 act as a counter by counting pulses from external input pin 3.4. Cleared to zero by program to make timer act as a timer by counting internal frequency.
1 M1 -- Timer/counter operating mode select bit 1. Set/cleared by program to select mode.
0 M0 -- Timer/counter operating mode select bit 0. Set/cleared by program to select mode.

M1 M0 Mode Description
0 0 0 Use the THX register as an 8-bit counter and the TLX as a 5-bit counter.
0 1 1 Use the THX register as an 8-bit counter and the TLX as an 8-bit counter.
1 0 2 Use only the TLX register as an 8-bit counter.
1 1 3 In modes 0 - 2, Timers 0 and 1 may be programmed independently.

In mode 3:

Timer 0 in mode 3 becomes two separate 8-bit counters.

Timer 1 in mode 3 may still be used, but will generate no interrupts.

 

TMOD is not bit addressable.
Direct Byte Address is 89h.

The only difference in counting and time is the source of the clock pulses to the counters.


©2004, Gary L. Burt