English
Language : 

C8051F58X Datasheet, PDF (307/356 Pages) Silicon Laboratories – Programmable hysteresis and response time Configurble as interrupt or reset source Low current
C8051F58x/F59x
2
SYSCLK
12
External Clock
(XTAL1)
Tn
8
0
1
Crossbar
TRn
EXENn
TnE
Crossbar
X
TMRnCF
T
n
M
1
T
n
M
0
T
O
G
n
T
n
O
E
D
E
C
E
n
Toggle Logic
0
0xFF
0xFF
1
Tn
(Port Pin)
TCLK TMRnL
OVF
TMRnH
Reload TMRnCAPL TMRnCAPH
CP/RLn
C/Tn
TRn
EXENn
EXFn
TFn
Interrupt
Figure 27.11. Timer 4 and 5 Auto Reload and Toggle Mode Block Diagram
27.4.4. Toggle Output Mode
Timers 4 and 5 have the capability to toggle the state of their respective output port pins (T4 or T5) to pro-
duce a 50% duty cycle waveform output. The port pin state will change upon the overflow or underflow of
the respective timer (depending on whether the timer is counting up or down). The toggle frequency is
determined by the clock source of the timer and the values loaded into TMRnCAPH and TMRnCAPL.
When counting down, the auto-reload value for the timer is 0xFFFF, and underflow will occur when the
value in the timer matches the value stored in TMRnCAPH:TMRCAPL. When counting up, the auto-reload
value for the timer is TMRnCAPH:TMRCAPL, and overflow will occur when the value in the timer transi-
tions from 0xFFFF to the reload value.
To output a square wave, the timer is placed in reload mode (the Capture/Reload Select Bit in TMRnCN
and the Timer/Counter Select Bit in TMRnCN are cleared to 0). The timer output is enabled by setting the
Timer Output Enable Bit in TMRnCF to 1. The timer should be configured via the timer clock source and
reload/underflow values such that the timer overflow/underflows at 1/2 the desired output frequency. The
port pin assigned by the crossbar as the timer’s output pin should be configured as a digital output (see
Section “20. Port Input/Output” on page 186). Setting the timer’s Run Bit (TRn) to 1 will start the toggle
of the pin. A Read/Write of the Timer’s Toggle Output State Bit (TMRnCF.2) is used to read the state of the
toggle output, or to force a value of the output. This is useful when it is desired to start the toggle of a pin in
a known state, or to force the pin into a desired state when the toggle mode is halted.
Fsq
=
------------------------F----T---C----L---K-------------------------
2  65536 – TMRnCAP
Equation 27.1. Square Wave Frequency
Rev. 1.2
307