Posts

Showing posts with the label Counter

Timer Counter Microcontroller 8051

Image
8051 has two 16-bit programmable UP timers/counters, T0 and T1 respectively.  we know 8051 processes on 8 bit data hence we have access to timer using  8-bit special function registers,  TL0 and TH0 for timer 0 and TL1 and TH1 for timer 1 respectively. We can use timer as an timer or counter. If we use timer as a timer then then clock source is on chip oscillator otherwise if we want to use timer as a counter then clock source is external clock. When we want to create delay using timer then we set some value in respective SFR's of timer. When timer is started  the value of SFR i.e value of count gets  incremented in every machine cycle. Thus, one can think of it as counting machine cycles. Hence we can say the clock rate for timer is 1/12 th of the oscillator frequency.  When we use timer as a counter, the respective SFR is incremented in response to a 1 to 0 transition at its corresponding external input pin (T0 or T1). It requires 2 machine cycles to det...