Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/28/02 18:15
Read: times


 
#20275 - Basic Question on 13 and 16 bit timers
Hello group

I am currently reading the 8051 tutorial (Chapter 7) and do not understand exactly how the 13 (and 16 for that matter) timers operate. The following text was cut from the tutorial:


*Start*
When the timer is in 13-bit mode, TLx will count from 0 to 31. When TLx is incremented from 31, it will "reset" to 0 and increment THx. Thus, effectively, only 13 bits of the two timer bytes are being used: bits 0-4 of TLx and bits 0-7 of THx. This also means, in essence, the timer can only contain 8192 values. If you set a 13-bit timer to 0, it will overflow back to zero 8192 machine cycles later.

Again, there is very little reason to use this mode and it is only mentioned so you won’t be surprised if you ever end up analyzing archaeic code which has been passed down through the generations (a generation in a programming shop is often on the order of about 3 or 4 months).
*End*

Alright. . If there are two bytes for each timer (TL0/TH0 for timer 0), how does it use 13 bits? In order to use the TL0 byte to count to 31, you need a minimum of 5 bits. If you used the remaining bits for the timer, you are left with 11 (meaning you could count to 2048). So how does it use only 3 bits to count to 31?

I guess my question with the 16 bit timer is similiar. If it used the entire TL0 byte to count to 255, how can the remaining 8 bits
(TH0) count to 65K? You would need the entire 16 bits to do that. Does it somehow reuse the TL0 byte while it is counting?

TIA for the help



List of 7 messages in thread
TopicAuthorDate
Basic Question on 13 and 16 bit timers            01/01/70 00:00      
RE: Basic Question on 13 and 16 bit timers            01/01/70 00:00      
RE: Basic Question on 13 and 16 bit timers            01/01/70 00:00      
RE: Basic Question on 13 and 16 bit timers            01/01/70 00:00      
RE: Basic Question on 13 and 16 bit timers            01/01/70 00:00      
RE: Basic Question on 13 and 16 bit timers            01/01/70 00:00      
RE: Basic Question on 13 and 16 bit timers            01/01/70 00:00      

Back to Subject List