On-chip peripherals
ST72324xx-Auto
The OC1R register value required for a specific timing application can be calculated using
the following formula:
OCiR value = t * fCPU - 5
PRESC
Where:
t
= Pulse period (in seconds)
fCPU = CPU clock frequnency (in hertz)
PRESC = Timer prescaler factor (2, 4 or 8 depending on the CC[1:0] bits; see Table 50)
If the timer clock is an external clock the formula is:
OCiR = t * fEXT - 5
t(s) Where:
uc t
= Pulse period (in seconds)
d fEXT = External timer clock frequency (in hertz)
ro When the value of the counter is equal to the value of the contents of the OC1R register, the
P OLVL1 bit is output on the OCMP1 pin (see Figure 45).
te Note: 1 The OCF1 bit cannot be set by hardware in one pulse mode but the OCF2 bit can generate
le an Output Compare interrupt.
so 2 When the Pulse Width Modulation (PWM) and One Pulse Mode (OPM) bits are both set, the
b PWM mode is the only active one.
O 3 If OLVL1 = OLVL2 a continuous signal will be seen on the OCMP1 pin.
) - 4 The ICAP1 pin can not be used to perform input capture. The ICAP2 pin can be used to
t(s perform input capture (ICF2 can be set and IC2R can be loaded) but the user must take
c care that the counter is reset each time a valid edge occurs on the ICAP1 pin and ICF1 can
u also generates interrupt if ICIE is set.
rod 5 When one pulse mode is used OC1R is dedicated to this mode. Nevertheless OC2R and
OCF2 can be used to indicate a period of time has been elapsed but cannot generate an
P output waveform because the level OLVL2 is dedicated to the one pulse mode.
te 6 In Flash devices, Timer A OCF2 bit is forced by hardware to 0.
ObsoleFigure 45. One Pulse mode timing example(1)
IC1R
01F8
2ED3
Counter 01F8 FFFC FFFD FFFE
ICAP1
2ED0 2ED1 2ED2
2ED3
FFFC FFFD
OCMP1
OLVL2
OLVL1
Compare1
OLVL2
1. IEDG1 = 1, OC1R = 2ED0h, OLVL1 = 0, OLVL2 = 1
86/193
Doc ID 13841 Rev 1