14 Timer
14 Timer
www.BharatAcharyaEducation.com
All the best J Watch Video Lectures of all topics by Bharat Acharya Page 81
BHARAT ACHARYA EDUCATION
Videos | Books | Classroom Coaching
E: [email protected]
M: 9820408217
Timer 1 Timer 0
C/T: (Counter/Timer)
Set (1) - Acts as Counter (Counts external frequency on T1 and T0 pin inputs).
Cleared (0) - Acts as Timer (Counts internal clock frequency, fosc/12).
M1 M0 Timer Mode
0 0 Mode 0
0 1 Mode 1
1 0 Mode 2
1 1 Mode 3
On each count (rising edge of the input clock) the counter increments its value.
When the counter rolls over (i.e. form all 1's to all 0's) it is said to overflow.
If timer interrupt is enabled then the Timer Interrupt will occur on overflow.
www.BharatAcharyaEducation.com
All the best J Watch Video Lectures of all topics by Bharat Acharya Page 82
MICROPROCESSORS 8051 & ARM
Author: Bharat Acharya
Sem V – EXTC
Mumbai 2018
As shown above, based on C/T bit the timer functions as a Counter or as a Timer.
If it is a Timer, it will count the internal clock frequency of 8051 divided by 12d (f/12).
If it is a Counter, the input clock signal is applied at the TX (T1 or T0) input pins for Timer1 or
Timer0 respectively. #Please refer Bharat Sir's Lecture Notes for this ...
As shown the Timer is running only if the TRX bit (TR1 or TR0) is set.
Also if the Gate bit is set in the TMOD then the INTX ( INT1 or INT0 ) pin must be “high (1)”
for the timer to count.
www.BharatAcharyaEducation.com
All the best J Watch Video Lectures of all topics by Bharat Acharya Page 83
BHARAT ACHARYA EDUCATION
Videos | Books | Classroom Coaching
E: [email protected]
M: 9820408217
All 16-bits of the Counter are used (8 bits of THX and 8 bits of TLX).
On each count the 16-bit Timer increments.
The timer overflow flag TFX is set when the Timer rolls-over from FFFFH to 0000H.
Max Count => 216 = 16K = 65536 (FFFFH). Hence Max Delay è 65536(12/f).
www.BharatAcharyaEducation.com
All the best J Watch Video Lectures of all topics by Bharat Acharya Page 84
MICROPROCESSORS 8051 & ARM
Author: Bharat Acharya
Sem V – EXTC
Mumbai 2018
www.BharatAcharyaEducation.com
All the best J Watch Video Lectures of all topics by Bharat Acharya Page 85