Your SlideShare is downloading. ×
0
TIMER
TIMERS <ul><li>The 8051 has two Timers/Counters. </li></ul><ul><li>Timer 0 and Timer 1. </li></ul><ul><li>Both have 16 bit...
TH and TL <ul><li>The TIMERS are divided into two 8-bit called Timer LOW (TL0, TL1) & Timer HIGH (TH0, TH1) </li></ul><ul>...
TMODE <ul><li>TMOD (timer mode), to set the various timer operation modes. </li></ul><ul><li>TMOD is 8 bit register. </li>...
TMODE TIMER 1  TIMER 0  M0 M1 C/ T GATE M0 M1 C/ T GATE
<ul><li>C/T  -  Timer or counter selector. </li></ul><ul><li>Gate -  to select software or hardware to select the timer ru...
TIMER MODES Split mode 3 1 1 8 bit auto reload 2 0 1 16 bit timer 1 1 0 13 bit timer 0 0 0 OPERATIONS MODE M0 M1
TCON REGISTER <ul><li>The lower 4 bits are set aside for controlling the interrupt bits. </li></ul><ul><li>The upper four ...
<ul><li>TF - is the overflow flag. </li></ul><ul><li>TR – is the run/stop control bit of Timers.  </li></ul>
MODE 1 <ul><li>16 bit timer. </li></ul><ul><li>Range is 0000 to FFFFh. </li></ul><ul><li>TH and TL are loaded with a 16-bi...
<ul><li>To calculate the values to be loaded into the TL and TH registers. </li></ul><ul><li>Divide the desired time delay...
MODE 0 <ul><li>It is an 13-bit timer. </li></ul><ul><li>Range is 000 to 1FFFh. </li></ul><ul><li>TH and TL are loaded with...
MODE 2 <ul><li>It is an 8-bit timer. </li></ul><ul><li>It allows only values of 00 to FFH. </li></ul><ul><li>TH is loaded ...
<ul><li>When it rolls over from FFH to 00, it sets high the TF (timer flag). </li></ul><ul><li>When TF is set to 1, TL is ...
MODE 3 <ul><li>Timer mode 3 is a split-timer mode.  </li></ul><ul><li>When Timer 0 is placed in mode 3, it  essentially be...
Thank you
Upcoming SlideShare
Loading in...5
×

Timers

2,962

Published on

timers in 8051 microcontroller.

Published in: Education, Technology, Business
1 Comment
9 Likes
Statistics
Notes
  • 8051 , nice core for quick project
    thanks
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
2,962
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
192
Comments
1
Likes
9
Embeds 0
No embeds

No notes for slide

Transcript of "Timers"

  1. 1. TIMER
  2. 2. TIMERS <ul><li>The 8051 has two Timers/Counters. </li></ul><ul><li>Timer 0 and Timer 1. </li></ul><ul><li>Both have 16 bits. </li></ul><ul><li>Accessed as low byte (TL) and high byte (TH). </li></ul><ul><li>The TIMER action is controlled by two more SFR's Registers </li></ul><ul><ul><li>Timer Mode Control Register( TMOD) . </li></ul></ul><ul><ul><li>Timer/Counter Control Register ( TCON ).  </li></ul></ul>
  3. 3. TH and TL <ul><li>The TIMERS are divided into two 8-bit called Timer LOW (TL0, TL1) & Timer HIGH (TH0, TH1) </li></ul><ul><li>These registers contain the latest count of the TIMER. </li></ul><ul><li>TL0 - 8A , TL1 8B, </li></ul><ul><li>TH0 - 8C , TH1 8D. </li></ul>
  4. 4. TMODE <ul><li>TMOD (timer mode), to set the various timer operation modes. </li></ul><ul><li>TMOD is 8 bit register. </li></ul><ul><ul><li>The lower 4 bits are for Timer 0. </li></ul></ul><ul><ul><li>The upper 4 bits are for Timer 1. </li></ul></ul><ul><ul><li>The lower 2 bits of nibble are used to set the timer mode. </li></ul></ul><ul><ul><li>The upper 2 bits to specify the operation. </li></ul></ul>
  5. 5. TMODE TIMER 1 TIMER 0 M0 M1 C/ T GATE M0 M1 C/ T GATE
  6. 6. <ul><li>C/T - Timer or counter selector. </li></ul><ul><li>Gate - to select software or hardware to select the timer run/stop bit. </li></ul><ul><ul><li>Gate = 0 software control the timer run/stop bit. </li></ul></ul><ul><ul><li>Gate = 1 hardware control the timer run/stop bit. </li></ul></ul><ul><li>M1 & M0 to select the timer mode. </li></ul>
  7. 7. TIMER MODES Split mode 3 1 1 8 bit auto reload 2 0 1 16 bit timer 1 1 0 13 bit timer 0 0 0 OPERATIONS MODE M0 M1
  8. 8. TCON REGISTER <ul><li>The lower 4 bits are set aside for controlling the interrupt bits. </li></ul><ul><li>The upper four bits are used to store the TF and TR bits of both timer 0 and 1. </li></ul>IT0 IE0 IT1 IE1 TR0 TF0 TR1 TF1
  9. 9. <ul><li>TF - is the overflow flag. </li></ul><ul><li>TR – is the run/stop control bit of Timers. </li></ul>
  10. 10. MODE 1 <ul><li>16 bit timer. </li></ul><ul><li>Range is 0000 to FFFFh. </li></ul><ul><li>TH and TL are loaded with a 16-bit initial value. </li></ul><ul><li>It counts up until it reaches its limit of FFFFh. </li></ul><ul><li>When it rolls over from FFFFH to 0000, it sets overflow flag TF (timer flag). </li></ul>
  11. 11. <ul><li>To calculate the values to be loaded into the TL and TH registers. </li></ul><ul><li>Divide the desired time delay by 1.085 us. </li></ul><ul><li>Perform 65536 – n, where n is the decimal value we got in Step1 </li></ul><ul><li>Convert the result of Step2 to hex, where yyxx is the initial hex value to be loaded into the timer’s register. </li></ul><ul><li>Set TL = xx and TH = yy. </li></ul>
  12. 12. MODE 0 <ul><li>It is an 13-bit timer. </li></ul><ul><li>Range is 000 to 1FFFh. </li></ul><ul><li>TH and TL are loaded with a 13-bit initial value. </li></ul><ul><li>It counts up until it reaches its limit of 1FFFh. </li></ul><ul><li>When it rolls over from 1FFFH to 0000, it sets overflow flag TF (timer flag). </li></ul>
  13. 13. MODE 2 <ul><li>It is an 8-bit timer. </li></ul><ul><li>It allows only values of 00 to FFH. </li></ul><ul><li>TH is loaded with the 8-bit value ,then the 8051 gives a copy of it to TL. </li></ul><ul><li>After the timer is started, it starts to count up by incrementing the TL register. </li></ul><ul><li>It counts up until it reaches its limit of FFH. </li></ul>
  14. 14. <ul><li>When it rolls over from FFH to 00, it sets high the TF (timer flag). </li></ul><ul><li>When TF is set to 1, TL is reloaded automatically with the original value kept by the TH register </li></ul><ul><li>This mode is also called Auto reload mode. </li></ul>
  15. 15. MODE 3 <ul><li>Timer mode 3 is a split-timer mode. </li></ul><ul><li>When Timer 0 is placed in mode 3, it essentially becomes two separate 8-bit timers. </li></ul><ul><li>Timer 0 is TL0 and Timer 1 is TH0. </li></ul><ul><li>Both timers count from 0 to 255 and overflow back to 0. </li></ul><ul><li>the control bit TR1 and the timer 1 flag TFI are then used by timer 0. </li></ul>
  16. 16. Thank you
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×