DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

AT89S2051 データシートの表示(PDF) - Atmel Corporation

部品番号
コンポーネント説明
メーカー
AT89S2051 Datasheet PDF : 45 Pages
First Prev 11 12 13 14 15 16 17 18 19 20 Next Last
15. Timer/Counters
The AT89S2051/S4051 have two 16-bit Timer/Counters: Timer 0 and Timer 1. The
Timer/Counters are identical to those in the AT89C2051/C4051. For more detailed information
on the Timer/Counter operation, please click on the document link below:
http://www.atmel.com/dyn/resources/prod_documents/DOC4316.PDF
16. Pulse Width Modulation
Timer 0 and Timer 1 may be configured as an 8-bit pulse width modulator by setting the PWMEN
bit in PCON. The generated waveform is output on the Timer 1 input pin, T1. In PWM mode
Timer 0 acts as an 8-bit prescaler to select the PWM timebase. Timer 0 is forced into Mode 2 (8-
bit auto-reload) by PWMEN and the value in TH0 will determine the clock division from 0 (FFh)
to 256 (00h). Timer 1 acts as the 8-bit PWM counter. TL1 counts once on every overflow from
TL0. TH1 stores the 8-bit pulse width value. On the FFh-->00h overflow of TL1, the PWM output
is set high. When the count in TL1 matches the value in TH1, the PWM output is set low. There-
fore, the output pulse width is proportional to the value in TH1. To prevent glitches, writes to TH1
only take effect on the FFh-->00h overflow of TL1. However, a read from TH1 will read the new
value at any time after a write to TH1. See Figure 16-1 for PWM waveform example.
Figure 16-1. Pulse Width Modulation (PWM) Output Waveform
Counter Value (TL1)
Compare Value (TH1)
Figure 16-2. Timer 0/1 Pulse Width Modulation Mode
TH1
PWM Output (T1)
TH0
OSC ÷12
TL0
OCR
=?
TL1
PWM
P3.5
TL0 counts once every machine cycle (1 machine cycle = 12 clocks in X1 mode) and TH0 is the
reload value for when TL0 overflows. Every time TL0 overflows TL1 increments by one, with TL0
overflowing after counting 256 minus TH0 machine cycles.
To calculate the pulse width for the PWM output on pin T1, users should use the following
formula:
TH1 * (256 - TH0) * (1/clock_freq) * 12 = Pulse Width
14 AT89S2051/S4051
3390C–MICRO–7/05

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]