63
Counter/Timer Calculations and Programming using 8051 Microcontroller
In application software development delay is one of the important factors that effects a development process of software. However, the normal delay will not provide the particular result for overcoming the problem for implementing the timer delay.
The counters and timers are hardware component of microcontroller, which is used in many applications for providing the precious time delay with count pulses. The counter and timer both are implemented by using the software technique.
Difference between a Timer and a Counter
Let’s see the points that differentiate between a timer and a counter as given below:
Counter | Timer |
---|---|
The register is incremented considering 1 to 0 transitions at its corresponding to an external input pin (T0, T1). | The register incremented for every machine cycle. |
A counter uses an external signal to count pulses. | A timer uses the frequency of the internal clock signal, and generates delay. |
Maximum count rate is 1/24 of the oscillator frequency. | Maximum count rate is 1/12 of the oscillator frequency. |
Timer Delay
Let’s see the program for generating time delay using timer1 and mode2 (T1M2):
Normal Loop Delay
Next TopicSerial Communication