Tuesday, February 26, 2019

FMA Unit 3.3 A Timer and Counter


A Timer and Counter

The microcontroller 8051 has two 16 bit Timer/Counter register namely Timer 0 (T0) and Timer (T1). Both these register can be configured independently as a timer or Counter.

Timer:
·         If the timer incremented by Internal Clock then it is called as Timer.
·         It is a specialized type of clock which is used to measure time intervals.
·         A timer that counts from zero upwards for measuring time elapsed is often called a stopwatch.
·         It is a device that counts down from a specified time interval and used to generate a time delay.
·         The register incremented for every machine cycle i.e 12 oscillator periods.
·         Maximum count rate is 1/12th  of the oscillator frequency.


Counter:
·         If the timer incremented by External Clock then it is called as Counter.
·         A counter is a device that stores (and sometimes displays) the number of times a particular event or process occurred, with respect to a clock signal.
·         It is used to count the events happening outside the microcontroller.
·         The register is incremented in response to high to low of the corresponding to an external input pin (T0, T1). Hence it requires two machine cycles i.e 24 oscillator periods.
·         Maximum count rate is 1/24th  of the oscillator frequency.



Timers of 8051 and their Associated Registers
The 8051 has two timers, Timer 0 and Timer 1. They can be used as timers or as event counters. Both Timer 0 and Timer 1 are 16-bit wide. Since the 8051 follows an 8-bit architecture, each 16 bit is accessed as two separate registers of low-byte and high-byte.

Timer 0 Register



·         The 16-bit register of Timer 0 is accessed as low-byte and high-byte.
·         The low-byte register is called TL0 (Timer 0 low byte) and the high-byte register is called TH0 (Timer 0 high byte).
·         These registers can be accessed like any other register.
·         For example, the instruction MOV TL0, #4H moves the value into the low-byte of Timer #0.



Timer 1 Register


·         The 16-bit register of Timer 1 is accessed as low- and high-byte.
·         The low-byte register is called TL1 (Timer 1 low byte) and the high-byte register is called TH1 (Timer 1 high byte).
·         These registers can be accessed like any other register.
·         For example, the instruction MOV TL1, #4H moves the value into the low-byte of Timer 1.


No comments:

Post a Comment