Product News

What is the working principle of a timer

Publish Time: Author: Site Editor Visit: 157

Timer is an instrument used to control time. With the advancement of science and technology, people have continuously improved and upgraded timers, and now they can achieve the goal of accurately controlling time. The emergence of timers has brought great convenience to people's lives, and timers have been widely used in both industrial control and military fields

What is a microcontroller timer

The microcontroller timer is actually the same electronic component as the commonly used counter, except that the counter records the external situation of the microcontroller and receives external pulses. The timer is a very stable counter provided by the microcontroller itself, which is the crystal oscillator component connected to the microcontroller.


Types of microcontroller timers

In microcontroller, it is divided into software timer, non programmable hardware timer, and programmable timer.
1. Software timing: The CPU requires a fixed time to execute each instruction, so executing empty instructions can achieve a delay effect. The cost of doing so is to occupy CPU time, so it is generally rare to do so.
2. Non programmable hardware timer: The timing function is completed by the circuit and hardware, usually using a basic circuit with external timing components (resistors and capacitors). The timing value is modified by changing the resistance value of the resistor and the capacitance value of the capacitor. Once the latter is determined, it cannot be modified through software. The advantage of this approach is that it does not require CPU time.
3. Programmable timer: The timing value and its range are determined through software, and the programmable timer has powerful functions and high flexibility. This is the timer explained in detail in this article.

Working principle of microcontroller timer

The core of a timer is a plus 1 counter. When used as a timer, it counts the machine cycles and adds 1 to the counter for each machine cycle until it overflows. When it is used for counting external events, the counter is connected to the corresponding external input pins T0 (P3.4) or T1 (P3.5) and sampled at S5P2 of each machine cycle. When a negative jump of 1-0 is sampled, the counter is incremented by 1.So, the working principle of a microcontroller timer is essentially a counter. Each time the pulse drops, the count register value will increase by 1. If the counting pulse comes from the crystal vibration inside the microcontroller, it is called a timer; If the counting pulse comes from a pin outside the microcontroller, it



Get in Touch

Captcha Code
If you are interested to be our agent in your market, we will be your strong backup.
Find us to cooperate