TMP91C824
91C824-108
2008-02-20
Example: To generate 1/4-duty 50-kHz pulses (at fc
=
33 MHz)
*
Clock state
System clock: High frequency (fc)
Clock gear:
1 (fc)
Prescaler clock: f
FPH
Calculate the value which should be set in the timer register.
To obtain a frequency of 50 kHz, the pulse cycle t should be: t
=
1/50 kHz
=
20
µ
s
φ
T1
=
(2
3
/fc)s (at 33 MHz);
20
µ
s ÷ (2
3
/fc)s
≈
83
Therefore set TA1REG
=
83
=
53H
The duty is to be set to 1/4: t
×
1/4
=
20
µ
s
×
1/4
=
5
µ
s
5
µ
s ÷ (2
3
/fc)s
≈
10
Therefore, set TA0REG
=
21
=
15H.
7 6 5 4 3
2
1
0
TA01RUN
←
–
X X X –
0
0
0
Stop TMRA0 and TMRA01 and clear it to 0.
TA01MOD
←
1 0 X X X
X
0
1
Set the 8-bit PPG mode, and select
φ
T1 as input clock.
TA0REG
←
0 0 0 1 0
1
0
1
Write
15H
TA1REG
←
0 1 0 1 0
0
1
1
Write
53H
TA1FFCR
←
X X X X 0
1
1
X
Set TA1FF, enabling both inversion and the double buffer.
Writing 10 provides negative logic pulse.
PBCR
←
X
–
–
–
–
–
1
–
PBFC
←
X – – – –
–
1
X
Set PB1 as the TA1OUT pin.
TA01RUN
←
1 X X X –
1
1
1
Start
TMRA0
and
TMRA01
counting.
X: Don’t care,
−
: No change
20
µ
s