Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8051 timer selection

Status
Not open for further replies.

niranjan23

Member level 5
Member level 5
Joined
Jan 22, 2012
Messages
94
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Visit site
Activity points
2,109
I want to know

which timer is selected when we Set TMOD=00H, that mean all the 8 bits are zero's?

And TMOD=00H at this condition which timer will take 8051 default?

And if I want to select Timer 1 in mode 0 or Timer 0 in mode 0 is that TMOD=00H is right??!! Or what will happen in this case while selection of timer in any mode??

& What 8051 CPU will take decision???
 

The TMOD or Timer Mode Special Function Register (SFR) simply determines the mode of either Timer0 or Timer1 when enabled/started.

The purpose of the TCON or Timer Control SFR is to enable/start or disable/stop either Timer0 or Timer1.

Therefore without enabling/starting Timer0 or Timer1 by setting either bits TR0 or TR1 respectfully in TCON SFR, the current value in TMOD SFR is irrelevant.

Concerning Timer Mode 0 operation:

Reference: **broken link removed**
13-bit Time Mode (mode 0)

Timer mode "0" is a 13-bit timer. This is a relic that was kept around in the 8051 to maintain compatability with its predecesor, the 8048. Generally the 13-bit timer mode is not used in new development.

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 wont 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).

Additional 8051 Timer Information:

Programming Timers on 8051

BigDog
 
  • Like
Reactions: S.P.S

    S.P.S

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top