TIMERS & Counters
TIMERS & Counters
TIMERS & Counters
If the timer uses an internal quartz oscillator for its operation then it can be used
to measure time between two events (if the register value is T1 at the moment
measurement starts, and T2 at the moment it terminates, then the elapsed time is
equal to the result of subtraction T2-T1). If registers use pulses coming from
external source then such a timer is turned into a counter.
WATCHDOG TIMER
A watchdog timer is a timer connected to a completely separate RC oscillator
within the microcontroller.
If the watchdog timer is enabled, every time it counts up to the maximum value,
the microcontroller reset occurs and the program execution starts from the first
instruction. The point is to prevent this from happening by using a specific
command.
Anyway, the whole idea is based on the fact that every program is executed in
several longer or shorter loops. If instructions which reset the watchdog timer
are set at the appropriate program locations, besides commands being regularly
executed, then the operation of the watchdog timer will not affect the program
execution. If for any reason, usually electrical noise in industry, the program
counter ‘gets stuck' at some memory location from which there is no return, the
watchdog timer will not be cleared, so the register's value being constantly
incremented will reach the maximum et voila! Reset occurs!
A/D CONVERTER
External signals are usually fundamentally different from those the
microcontroller understands (ones and zeros) and have to be converted therefore
into values understandable for the microcontroller. An analogue to digital
converter is an electronic circuit which converts continuous signals to discrete
digital numbers. In other words, this circuit converts an analogue value into a
binary number and passes it to the CPU for further processing. This module is
therefore used for input pin voltage measurement (analogue value).