
ST52F510/F513/F514
71/106
Figure 12.2 Timer 0 External Start/Stop Mode
TxSTRT
counting only if the peripherals are configured in
Timer mode. The Timers are started by writing 1 in
the TXSTRT bit of the PWMx_CR1 and are
stopped by writing 0. Thissignal can be generated
internally and/or externally by forcing the T0STRT
pin (only TIMER0).
TIMER 0 START/STOP can be given externally on
the T0STRT pin. In this case, the T0STRT signal
allows the user to workin two different configurable
modes:
I
LEVEL (Time Counter): If the T0STRT signal is
high, the Timer starts counting. When the
T0STRT is low the timer stops counting and the
16-bit current value is stored in the
PWM0_COUNT_IN_x Input Registers couple.
signal
starts/stops
the
Timer
from
I
EDGE (Period Counter): After reset, on the first
T0STRT rising edge, TIMER 0 starts counting
and at the next rising edge it stops. In this
manner the period of an external signal may be
measured.
The same modes are available for the T0RES pin
signal.
The polarity of the T0SRTR Start/Stop signal can
be changed by setting the STRPOL and RESPOL
bits inthe INT_POL Configuration Register (01hbit
3 and 4). When these bits are set, the PWM/Timer
0 is Started/Set on the low level or in the falling
edge of the signal applied in the pins.
The Timer output signal, TxOUT, is a signal with a
frequency equal to the one of the 16 bit-Prescaler
output signal, PRESCOUTx, divided by a 16-bit
counter set by writing the Output Register couple
PWMx_COUNT_OUT_x.
Note:
the contents of these registers upgrades the
Timer counter after it stops counting. Since the
register couple is written in two steps this can
cause side effects. In order to avoid this, the user
should write the MSB before writing the LSB:
actually, the 16-bit value is latched in parallel when
the LSB is written. By writing only the LSB (and
MSB equal to 0), the PWM/Timer is used as with
an 8 bit counter.
There can be two types of TxOUT waveforms:
I
type 1: TxOUT waveform equal to a square
wave with a 50% duty-cycle
I
type 2:TxOUT waveform equal toa pulse signal
with the pulse duration equal to the Prescaler
output signal.
Figure 12.3 TxOUT Signal Types
Level
Edge
start
stop
start
start
stop
start
0
1
1
0
4
4
3
2
Reset
Clock
Counted
Value
Timer Output
Type 1
Type 2
Prescout*Counter