13-Calculation Steps and Problem Based On Timers MODE 1-06-02-2024
13-Calculation Steps and Problem Based On Timers MODE 1-06-02-2024
Microcontroller 8051
Peripherals: Timers-Counters
8051 Pin Diagram
8051
Architecture
Special Function Registers [SFR]
8051 TMOD Register
TCON
Important Points to Start Timer
▪ Timers of 8051 do starting and stopping by either software or
hardware control.
▪ In using software to start and stop the timer where GATE = 0.
▪ The start and stop of the timer are controlled by way of software
by the TR (timer start) bits TR0 and TR1
▪ Instructions:
SETB (Start), CLR (Stop)
▪ The hardware way of starting and stopping the timer by an
external source is achieved by making GATE = 1 in the TMOD
register
How to Load Count?
❑ Attributes to Loads Count value:
▪ Timers are up Counter.
▪ As it will receive clock it will be increment by 1.
▪ Maximum Count FFFFH.
▪ When it reaches to FFFFH, it will roll back to 0000H.
▪ During that time, it will generate Timer overflow interrupt.
❑ So, load value in Counter:
How to Load Count?
Example: if you wants to count 9 then