8051 TMOD Register
Both timers 0 and 1 use the same register, called TMOD (timer mode).
- TMOD is a 8-bit register.
- The lower 4 bits are for Timer 0.
- The upper 4 bits are for Timer 1.
- In each case,
- The lower 2 bits are used to set the timer mode.
- The upper 2 bits to specify the operation.
Gating control when set. Timer/counter is enable only while the INTx pin is high and the TRx control pin is set
When cleared, the timer is enabled whenever the TRx control bit is set.
- Timers of 8051 do starting and stopping by either software or hardware control.
- In using software to start and stop the timer where GATE=0
- The start and stop of the timer are controlled by way of software by the TR(timer start) bits TR0 and TR1
- To start Timer, TR0 or TR1 must be high. or To stop Timer, TR0 or TR1 must be low. These instructions start and stop the timers as long as GATE=0 in the TMOD register
- The hardware way of starting and stopping the timer by an external source is achieved by making GATE=1 in the TMOD register
- Timer or counter selected Cleared for timer operation (input from internal system clock). Set for counter operation (input from Tx input pin).
- If C/T = 0, it is used as a timer for time delay generation. The clock source for the time delay is the crystal frequency of the 8051.
- If C/T = 1, it is used as a counter for event counters to count events happening outside the microcontroller.
- Find the timer’s clock frequency and its period for various 8051-based system, with the crystal frequency 11.0592 MHz when C/T bit of TMOD is 0.
Click On Image For Zoom View
1/12 ×11.0529 MHz = 921.6 MHz;
T = 1/921.6 kHz = 1.085 us.
|0||0||0||13-bit timer mode8-bit timer/counter THx with TLx as 5-bit pre-scaler|
|0||1||1||16-bit timer mode16-bit timer/counter THx and TLx are cascaded; there is no prescaler|
|1||0||2||8-bit auto reload8-bit auto reload timer/counter; THx holds a value which is to be reloaded TLx each time it overfolws|
|1||1||3||Split timer mode|
(a) TMOD = 00000001, mode 1 of timer 0 is selected.
(b) TMOD = 00100000, mode 2 of timer 1 is selected.
(c) TMOD = 00010010, mode 2 of timer 0, and mode 1 of timer 1 are selected.
The Intel 8051 microcontroller is among one of the most popular general purpose microcontrollers in use today. The success of the Intel 8051 spawned a number of clones which are collectively referred to as the MCS-51 family of microcontrollers, which includes chips from vendors such as Atmel, Philips, Infineon, and Texas Instruments.
- 1947 Invention of Transistors.
- 1959 Invention of Integrated Circuits.
- 1971 Invention of Microprocessor.
- 1976 Invention of Microcontroller.
Today, over 50 companies produce variations of the 8051. 8051 cores are available for implementations in Field Programmable Gate Arrays (FPGA) or Application Specific Integrated Circuits (ASIC). The 8051 was developed by Intel but other manufacturers (e.g., Siemens, Philips, Atmel, etc.) are second sources of this family of devices.
- Lectures 16
- Quizzes 0
- Duration 10 hours
- Skill level All levels
- Language English
- Students 51
- Certificate No
- Assessments Self