Timers

67 %
33 %
Information about Timers
Education

Published on May 28, 2009

Author: afzal_pa

Source: slideshare.net

Description

timers in 8051 microcontroller.

TIMER

TIMERS The 8051 has two Timers/Counters. Timer 0 and Timer 1. Both have 16 bits. Accessed as low byte (TL) and high byte (TH). The TIMER action is controlled by two more SFR's Registers Timer Mode Control Register( TMOD) . Timer/Counter Control Register ( TCON ). 

The 8051 has two Timers/Counters.

Timer 0 and Timer 1.

Both have 16 bits.

Accessed as low byte (TL) and high byte (TH).

The TIMER action is controlled by two more SFR's Registers

Timer Mode Control Register( TMOD) .

Timer/Counter Control Register ( TCON ). 

TH and TL The TIMERS are divided into two 8-bit called Timer LOW (TL0, TL1) & Timer HIGH (TH0, TH1) These registers contain the latest count of the TIMER. TL0 - 8A , TL1 8B, TH0 - 8C , TH1 8D.

The TIMERS are divided into two 8-bit called Timer LOW (TL0, TL1) & Timer HIGH (TH0, TH1)

These registers contain the latest count of the TIMER.

TL0 - 8A , TL1 8B,

TH0 - 8C , TH1 8D.

TMODE TMOD (timer mode), to set the various timer operation modes. TMOD is 8 bit register. The lower 4 bits are for Timer 0. The upper 4 bits are for Timer 1. The lower 2 bits of nibble are used to set the timer mode. The upper 2 bits to specify the operation.

TMOD (timer mode), to set the various timer operation modes.

TMOD is 8 bit register.

The lower 4 bits are for Timer 0.

The upper 4 bits are for Timer 1.

The lower 2 bits of nibble are used to set the timer mode.

The upper 2 bits to specify the operation.

TMODE TIMER 1 TIMER 0 M0 M1 C/ T GATE M0 M1 C/ T GATE

C/T - Timer or counter selector. Gate - to select software or hardware to select the timer run/stop bit. Gate = 0 software control the timer run/stop bit. Gate = 1 hardware control the timer run/stop bit. M1 & M0 to select the timer mode.

C/T - Timer or counter selector.

Gate - to select software or hardware to select the timer run/stop bit.

Gate = 0 software control the timer run/stop bit.

Gate = 1 hardware control the timer run/stop bit.

M1 & M0 to select the timer mode.

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 The lower 4 bits are set aside for controlling the interrupt bits. The upper four bits are used to store the TF and TR bits of both timer 0 and 1. IT0 IE0 IT1 IE1 TR0 TF0 TR1 TF1

The lower 4 bits are set aside for controlling the interrupt bits.

The upper four bits are used to store the TF and TR bits of both timer 0 and 1.

TF - is the overflow flag. TR – is the run/stop control bit of Timers.

TF - is the overflow flag.

TR – is the run/stop control bit of Timers.

MODE 1 16 bit timer. Range is 0000 to FFFFh. TH and TL are loaded with a 16-bit initial value. It counts up until it reaches its limit of FFFFh. When it rolls over from FFFFH to 0000, it sets overflow flag TF (timer flag).

16 bit timer.

Range is 0000 to FFFFh.

TH and TL are loaded with a 16-bit initial value.

It counts up until it reaches its limit of FFFFh.

When it rolls over from FFFFH to 0000, it sets overflow flag TF (timer flag).

To calculate the values to be loaded into the TL and TH registers. Divide the desired time delay by 1.085 us. Perform 65536 – n, where n is the decimal value we got in Step1 Convert the result of Step2 to hex, where yyxx is the initial hex value to be loaded into the timer’s register. Set TL = xx and TH = yy.

To calculate the values to be loaded into the TL and TH registers.

Divide the desired time delay by 1.085 us.

Perform 65536 – n, where n is the decimal value we got in Step1

Convert the result of Step2 to hex, where yyxx is the initial hex value to be loaded into the timer’s register.

Set TL = xx and TH = yy.

MODE 0 It is an 13-bit timer. Range is 000 to 1FFFh. TH and TL are loaded with a 13-bit initial value. It counts up until it reaches its limit of 1FFFh. When it rolls over from 1FFFH to 0000, it sets overflow flag TF (timer flag).

It is an 13-bit timer.

Range is 000 to 1FFFh.

TH and TL are loaded with a 13-bit initial value.

It counts up until it reaches its limit of 1FFFh.

When it rolls over from 1FFFH to 0000, it sets overflow flag TF (timer flag).

MODE 2 It is an 8-bit timer. It allows only values of 00 to FFH. TH is loaded with the 8-bit value ,then the 8051 gives a copy of it to TL. After the timer is started, it starts to count up by incrementing the TL register. It counts up until it reaches its limit of FFH.

It is an 8-bit timer.

It allows only values of 00 to FFH.

TH is loaded with the 8-bit value ,then the 8051 gives a copy of it to TL.

After the timer is started, it starts to count up by incrementing the TL register.

It counts up until it reaches its limit of FFH.

When it rolls over from FFH to 00, it sets high the TF (timer flag). When TF is set to 1, TL is reloaded automatically with the original value kept by the TH register This mode is also called Auto reload mode.

When it rolls over from FFH to 00, it sets high the TF (timer flag).

When TF is set to 1, TL is reloaded automatically with the original value kept by the TH register

This mode is also called Auto reload mode.

MODE 3 Timer mode 3 is a split-timer mode. When Timer 0 is placed in mode 3, it essentially becomes two separate 8-bit timers. Timer 0 is TL0 and Timer 1 is TH0. Both timers count from 0 to 255 and overflow back to 0. the control bit TR1 and the timer 1 flag TFI are then used by timer 0.

Timer mode 3 is a split-timer mode.

When Timer 0 is placed in mode 3, it essentially becomes two separate 8-bit timers.

Timer 0 is TL0 and Timer 1 is TH0.

Both timers count from 0 to 255 and overflow back to 0.

the control bit TR1 and the timer 1 flag TFI are then used by timer 0.

Thank you

Add a comment

Related presentations

Related pages

Timer-Klasse (System.Timers)

Wenn AutoReset auf festgelegt ist false, ein System.Timers. Timer-Objekt löst die Elapsed-Ereignis nur einmal nach dem ersten Interval verstrichen ist.
Read more

Online Timer

Create timers with alarms and start/pause/stop them simultaneously or sequentially. Perfect for cooking, quizzes, speeches, sports, or music.
Read more

Countdown Timer - Countdown - Online Stopwatch

Countdown Timer is just the countdown taken out of the usual online-stopwatch.com stopwatch and countdown gadget. It makes it easier to get to the ...
Read more

Online Timer

Online Timer & Alarm: OnlineClock.net offers this simple digital Timer to use for FREE online. Use it at home, work or in the kitchen!
Read more

Timer-Klasse (System.Threading)

Tipp ; The .NET Framework Class Library includes four classes named Timer, each of which offers different functionality: System.Timers. Timer, which fires ...
Read more

Classroom Timers - Fun Timers - Online Stopwatch

A range of fun timers! Great for the classroom, or meetings. Bookmark some new educational materials today! All Free, all for download.
Read more

Timer - Wikipedia, the free encyclopedia

A timer is a specialized type of clock for measuring time intervals. By function timers can be categorized to two main types. A timer which counts upwards ...
Read more

Timer | bpb - Bundeszentrale für politische Bildung ...

Der Timer, der Notizkalender der bpb, ist ein unverzichtbarer Wegweiser durchs Jahr: informativ, aufwendig gestaltet, werbefrei. Unter jährlich ...
Read more

Stoppuhr (Timer) - Download - CHIP

Einfach aber gut: Timer ist eine Freeware-Stoppuhr für Windows. Timer Zeitmessen am PC, das klingt nicht wirklich spannend. Aber überprüfen Sie mit der ...
Read more

TIME TIMER Tischuhr: Amazon.de: Sport & Freizeit

Abgelaufene Zeit ist ein abstrakter Begriff. Mit dem TIME TIMER wird Zeit sichtbar - ohne dass man sich auf eine herkömmliche Uhr konzentrieren muss.
Read more