Professional Documents
Culture Documents
8051 Timer and Counter
8051 Timer and Counter
Timer / Counter
• Two 16 bit timer / counter
• Timer is used to generate time delay
• Counter is used to count the event happening
outside the MCU.
• Each 16 bit register can be accused as two
separate 8 bit register
• Low byte(8bit) & High byte(8 bit)=16 bit
Low byte & High byte
TH0 TL0
TMOD Register ( Byte accessible )
Timer -1 Timer -0
gate C/T M1 M0 gate C/T M1 M0
7 6 5 4 3 2 1 0
• 0 1 0 0 0 0 0 0
• Setb TR1 ; TR1=1
• TF1 & TF0 ( timer flags)
– When timer rolls from all 1’s to 0’s TF1=TF0=1