8051 microcontroller programming:Timers-interfacing Timer0 and Timer1 together
Timers are one of the most important peripherals of 8051. There are two 16-bit counters present in 8051. It is controlled using TMOD register. G C/T M1 M0 G C/T M1 M0 The first four bits are for the Timer1 and the lower four bits are for the Timer0. G- Gate bit for timer1. 0-TR1 should be made high starting the timer. 1-INT1 and TR1 should be HIGH for starting the timer. C/T- Counter/Timer 0-Acts as timer .i.e. internal oscillator provides the clock. 1-Acts as counter .i.e. external crystal provides the clock. M1,M0- Mode selectors. M1 MO MODE FUNCTION 0 0 0 13-bit timer 0 1 1 16-bit timer 1 0 2 8-bit auto reload timer 1 1 3 Split timer Timer 1 in mode 2 is used for serial communication. Maximum count possible is in Mode-1, that is FFFF (66535). Delay(microseconds)=1.085*(F...