Tuesday, February 26, 2019

FMA Unit 3.5 Different Modes of Timers


Different Modes of Timers

Mode 0 (13-Bit Timer Mode)




·         Mode 0 is selected when M1 = 0 & M0 = 0 placed in TMOD SFR.
·         This is 13 bit timer can be loaded as TLx = 5 bits and THx = 8 bits
·   TLx can load value starting from 0 to 31 (001FH). When TLx is incremented above 31, it will reset to 0 and then start incrementing THx.
·         As this 13 bit timer, that counts starting from 0 to 8191. After that it will overflow.
·         When C/T(bar) , then timer will work as a timer to provide time delay.
·         When C/T(bar) , then timer counts external clock pulses applied at pin Tx.
  
Mode 1 (16-Bit Timer Mode)




·         Mode 1 is selected when M1 = 0 & M0 = 1 placed in TMOD SFR.
·         This is 16 bit timer can be loaded as TLx = 8 bits and THx = 8 bits
·         This mode is most commonly used and it provides maximum delay.
·      TLx can load value starting from 0 to 255. When TLx is incremented above 255, it will reset to 0 and then start incrementing THx.
·         As this 16 bit timer, that counts starting from 0 to 65535. After that it will overflow.
·         When C/T(bar), then timer will work as a timer to provide time delay.
·        When C/T(bar), then timer counts external clock pulses applied at pin Tx.



Mode 2 (8 Bit Auto Reload)



·         Mode 2 is selected when M1 = 1 & M0 = 0 placed in TMOD SFR.
·         It is 8 bit auto reloaded mode.
·      Initially 8 bit count loaded into THx which is automatically copied into TLx.
·         When Timer starts, clocks are received by TLx. TLx goes on incrementing up to its maximum value 255 and set the TFx.
· This mode is commonly used for deciding baud rate in serial communication.

  
Mode 3 (Split Timer Mode)



·         Mode 3 is selected when M1 = 1 & M0 = 3 placed in TMOD SFR.
·         When Timer 0 is placed in mode 3, it becomes two separate 8-bit timers.
·         Timer 0 is TL0 and Timer 1 is TH0. Both the timers count from 0 to 255 and in case of overflow, reset back to 0.
·         All the bits that are of Timer 1 will now be tied to TH0.
·         When Timer 0 is in split mode, the real Timer 1 (i.e. TH1 and TL1) can be set in modes 0, 1 or 2, but it cannot be started / stopped as the bits that do that are now linked to TH0.
·         The real timer 1 will be incremented with every machine cycle.



No comments:

Post a Comment