TCON (Timer Control Register)

The 8051 microcontroller has a unique function register called the TCON (Timer Control Register). In order to provide precise output, timers and counters are controlled by it. The data in the registers may overflow if these timers and counters are not under control. Thus, the TCON is utilized to control the timers and counters. The structure in detail is displayed below.

Structure of TCON

The TCON register is an 8-bit register, where each bit has a specific function:

TCON

Here’s what each bit represents:

Bit

Bit Name

Description

7

TF1 (Timer 1 Overflow Flag)

Set to 1 when Timer 1 overflows else 0.

6

TR1 (Timer 1 Run Control Bit)

Set to 1 to start Timer 1, and set to 0 to stop Timer 1.

5

TF0 (Timer 0 Overflow Flag)

Set to 1 when Timer 0 overflows else 0.

4

TR0 (Timer 0 Run Control Bit)

Set to 1 to start Timer 0, and set to 0 to stop Timer 0.

3

IE1 (Interrupt 1 Edge Flag)

Set to 1 when an external interrupt 1 occurs else 0.

2

IT1 (Interrupt 1 Type Control Bit)

Set to 1 to configure external interrupt 1 as edge-triggered, and set to 0 for level-triggered.

1

IE0 (Interrupt 0 Edge Flag)

Set to 1 when an external interrupt 0 occurs else 0.

0

IT0 (Interrupt 0 Type Control Bit)

Set to 1 to configure external interrupt 0 as edge-triggered, and set to 0 for level-triggered.

8051 Timers and Counters

8051 microcontrollers are mainly used to speed up our tasks because they are very easy to use and they are also fast to complete tasks easily. These microcontrollers have one main feature which is Timers and counters. This feature is widely used in microcontrollers to measure the time and as well as to count the events or tasks. By learning about these timers and counters ,we can make good embedded systems. In this article let us see how these counters and timers work in microcontrollers.

Table of Content

  • 8051 Timers and Counters
  • Types
  • What is Timer 0 (T0) ?
  • What is Timer 1 (T1) ?
  • TCON and TMOD
  • Timer Counter Modes
  • What is Counter Mode ?

Similar Reads

8051 Timers and Counters

Timers and counters are one of the best feature that is provided by microcontrollers. Timers are used to measure the time and for creating time delays . Counters are used to count the events or tasks that are taking place outside the microcontrollers. We can setup these timers and counters with the microcontrollers to make our tasks in different ways to fit in different tasks....

Types of 8051 Timers and Counters

The 8051 microcontroller mainly has two timers they are Timer 0 and Timer 1. These are used as both timers as well as counters. They are 16-bit long but the format of the microcontroller is 8-bit, due to that the Timers or counters are divided into two 8-bit parts a low byte and a high byte. Let’s see one by one,...

What is Timer 0 (T0) ?

Timer 0 is one of the main timers/counters in the 8051 microcontroller, used for doing timing operations and counting events. It is divided into two 8-bit registers they are TL0 (Timer 0 Low byte) and TH0 (Timer 0 High byte). By combining both, these form a 16-bit timer/counter....

What is Timer 1 (T1) ?

Timer 1 is also one of the main timers/counters in the 8051 microcontroller, used for doing timing operations and counting events. It is also divided into two 8-bit registers they are TL1 (Timer 1 Low byte) and TH1 (Timer 1 High byte). By combining both, these form a 16-bit timer/counter...

Timer Control Registers-TCON and TMOD

TCON and TMOD are the special function registers in the 8051 microcontroller. These are used to control the timers and counters....

TCON (Timer Control Register)

The 8051 microcontroller has a unique function register called the TCON (Timer Control Register). In order to provide precise output, timers and counters are controlled by it. The data in the registers may overflow if these timers and counters are not under control. Thus, the TCON is utilized to control the timers and counters. The structure in detail is displayed below....

TMOD (Timer Mode Register)

The TMOD (Timer Mode Register) is a special function register in the 8051 microcontroller. Timer 0 and Timer 1 are the modes of operation that it is utilized to set. Whether a timer or counter needs to be set, it is done so using this register. The structure in detail is displayed below....

Timer Counter Modes

The modes are divided into four as shown below....

What is Timer Mode ?

The Modes which are used to create time delays , measure time intervals, or generate precise time-based signals are known as Timer modes. The modes that acts as timers are given below,...

What is Counter Mode ?

The Modes which are used to count the number of events or pulses that are happening outside the microcontroller are known as Counter modes. The modes that acts as counters are given below,...

Conclusion

In order to create time delays, measure time intervals, and count events in embedded systems, 8051 timers and counters are necessary components. To fully utilize them in a variety of applications, it is crucial to comprehend how they operate and are configured....

8051 Timers and Counters – FAQs

Can 8051 timers be used for PWM generation?...