4.13 Analog to Digital Converter (ADC)
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
Hour
Minute
Second
RTC CNTH
RTC CNTL
Seconds
00
00
01
0x0000
0x0001
1s
00
01
01
0x0000
0x003D
3601s
23
00
01
0x0001
0x4371
82801
Table 4.1:
Configuration of the register RTC CNTL and RTC CNTH
Listing 4.9:
RTC ISR
void
RTC IRQHandler (
void
)
45
{
i f
(RTC
−
>
CRL & (1
<<
0) )
{
// check second f l a g
RTC
−
>
CRL &= ˜(1
< <
0) ;
// c l e a r second f l a g
// your code
}
50
i f
(RTC
−
>
CRL & (1
<<
1) )
{
// check alarm f l a g
RTC
−
>
CRL &= ˜(1
< <
1) ;
// c l e a r alarm f l a g
// your code
}
55
i f
(RTC
−
>
CRL & (1
<<
2) )
{
// check Overflow f l a g
RTC
−
>
CRL &= ˜(1
< <
2) ;
// c l e a r Overflow f l a g
// your code
}
60
}
// end RTC IRQHandler
4.13 Analog to Digital Converter (ADC)
b
ad1
F
reads the values and writes them on the serial interface (115200Baud)
4.13.1 Conversion Modes
The AD converters of the STM32F103RB can operate in two different modes:
•
Singleshot: The program triggers to read the value once.
•
Scan Mode: In scan mode, automatic conversion is performed on a selected group of analog
inputs.
STM32F103RB have two 12-bit Analog to Digital Converters which share up to 16 external chan-
nels. Additional logic functions embedded in the ADC interface allow:
•
Simultaneous sample and hold
•
Interleaved sample and hold
•
Single shot
The ADC can be served by the DMA controller. An analog watchdog feature allows very pre-
cise monitoring of the converted voltage of one, some or all selected channels. An interrupt is
generated when the converted voltage is outside the programmed thresholds.
Lukas Kohler
37