4.8 Timer (TIM)
1 Intro
2
Electrocardiogram (
Ecg
) Signals
The Electrocardiogram (
Ecg
)
•
Ecg
: electrical manifestation of heart activity recorded
from the body surface
•
monitoring of heart rate
The
Ecg
signal can be recorded fairly easily with surface
electrodes placed on the limbs and/or the chest, see pages
6
–
16
below.
Josef Goette
2
2009
4.8 Timer (TIM)
b
timer
F
Running light on GPIOB
The STM32 offers different kind of individually configurable timers:
•
General-purpose timer (TIMx): They may be used for a variety of purposes, including mea-
suring the pulse lengths of input signals (input capture) or generating output waveforms
(output compare and PWM).
•
Basic timer (TIM6 and TIM7): They may be used as generic timers for time-base generation
but they are also specifically used to drive the digital-to-analog converter (DAC). In fact,
the timers are internally connected to the DAC and are able to drive it through their trigger
outputs.
•
Advanced-control timers (TIM1 and TIM8): It may be used for a variety of purposes, in-
cluding measuring the pulse lengths of input signals (input capture) or generating output
waveforms (output compare, PWM, complementary PWM with dead-time insertion).
The timers consist of a 16-bit auto-reload counter driven by a programmable prescaler. The timers
are completely independent, and do not share any resources. They can be synchronized together
(not TIM6 and TIM7).
In the
µ
Vision configuration wizard the timers TIM1 ... TIM4 can be configured directly. The other
timers have to be configured using the FwLib.
4.8.1 Configuration
In the configuration wizard (see Figure
) the timer interrupt has to be enabled and configured.
Figure 4.9:
Timer Configuration Wizard
The function
void TIM1 UP IRQHandler (void)
gets called after the TIM1 period has expired.
Lukas Kohler
33