An embedded system is a mixture of computer hardware and software. A microprocessor or a microcontroller is used to build it. In the hardware section, the embedded system contains many things like user interface, Input or Output interfaces, memory, display and many more.
The most important part of this system that creates its overall structure is the power supply, processor, memory, timers, serial communication ports, and specific circuits regarding the system application.
When it comes to measuring the intervals of time, timers are used to get the job done. It is also called a stopwatch when it plays the role of time elapsed measurement. It starts it counting from zero and goes upward in a gradual manner.
Following the article, you will find out different types of timers in embedded systems. Also, it is written in a very easy way so that you can have a good understanding from start to the end.
Without further ado, let’s get started.
Different Types Of Timer In Embedded Systems
1. Watchdog Timer (WDT)
A watchdog timer (WDT) is a device that is present in the embedded systems. If the system detects any malfunction while it is operating in its normal manner, the timer immediately works on solving the problem.
Likewise, when the software does not operate properly, or it hangs out of the blue, the timer uses the 16-bit counter to reset the microcontroller system. Therefore, if a computer is not embedded with WDT, it is best to install WDT expansion cards to be on the safer side.
- WDT can detect errors like program errors, code crashes, the software hang, and even power surges. It can immediately detect system malfunctions.
- Uses the embedded reset signal present in the CPU to reset the operating systems and puts the activity of the program in its normal form.
- One WDT monitors another one of its types to make sure the one that is doing the task doesn’t get hang or face any system failure.
- You can test sandbox codes (security mechanism used to test untested codes from non-verified third parties, suppliers, etc.) that are highly unreliable by using WDT to ensure the system is properly secured.
- If you are using a website and it is not loading like it usually does, the timer starts the browser refresh functions automatically.
2. General Purpose Of Timer
These are basic timers that you can use for various purposes, including starting a device or measuring the time duration.
- It will provide some time delay when you will start some electrical device.
- In the case of robots assembling, this timer is very helpful in getting the work done successfully.
- To provide a situation where periodic intervals are needed, like the blinking of an LED, this timer performs accurately.
- It provides the opportunity to measure time length or duration between two scenarios. One example can be the time it took to press two buttons.
3. Interval Timer
This kind of timer is a programmable one. It provides an output signal when it starts and ends in a programmable count. The output signal might cause an interrupt to occur. In an embedded system, interrupt is mainly a signal from the input. It tells the processor that a certain action for a specific situation is required.
- It can either be the one-shot or periodic timer.
- In the case of the one-shot timer, it will signal for a single time, and then it will stop its counting process.
- For the periodic one, the timer signals for some amount of time until it reaches a specified value. After that, it restarts. Besides, the periodic timer generates signals at different periodic intervals. These are used in situations where certain activities need to be initiated at regular intermissions.
If a task is needed to be performed routinely, this timer is mandatory. Along with that, to measure massive durations, this device suits them best.
- It is programmed with intervals that are fixed. This interval helps in finding the amount of time it will take to provide the necessary signal.
4. Systick Timer
These can only be used for operating in a single mode (periodic and decrementing). They are used in RTOS (Real-Time Operating Systems) to generate periodic interrupts. These are then used in multitasking and context switching.
- It can easily provide time delays.
- Can generate periodic events smoothly.
- Found in all ARM Cortex-M chips. If a code is written in one microcontroller, the code you can use onto the other microcontroller by applying some minor changes. This reduces the time and effort in a very good way, thanks to this chip.
5. Real-Time Clock (RTC)
These are mainly timers that are of low resolution in comparison to the General purpose and Systick timers.
- These are mainly used to generate time in a readable format for humans.
- They have a rapid resolution in one second.
- It functions as a digital watch, used to tell the time to the user.
- A coin cell is used to power it up so that it can still run even the system is turned off. You can see the cells on the motherboard of the computer.
Also Read: Best Kitchen Timer
Importance of Timers in Embedded Systems
Without timers, the maintenance of timing is impossible. If you need to control the blinking rate of the LED or to generate a delay on the source code, the timers will surely play an important role as it is the heart of the embedded system.
If you check the website, you will find different information about the importance of timers in electronic devices. As technologies are upgrading to an enormous extent, so does the importance of timing devices.
Go through this article more than once so that you can get a good grip on it. Consult with experienced electrical workers or engineers for additional advice. They will provide you some suggestions that might help you out in the long run.
Have a good day!