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 Peripherals
4.6 Serial Interface (USART)
The serial interface is used to communicate with other devices. Nowadays it is often used as
debug interface to send information to a host like a PC. UARTs are commonly used in conjunction
with other communication standards such as EIA RS-232.
b
usart1
F
sends periodically the character ”*” with 9600Baud to its host.
b
usart2
F
sends periodically the ASCII characters with 9600Baud to its host.
b
usart3
F
polls the incoming data and sends them back to its sender (9600Baud)
b
usart4
F
sends periodically the string ”Hello World” with 115200Baud to its host using
printf()
.
b
usartIrq1
F
the data and sends them back to its sender (9600Baud, uses IRQ)
4.6.1 Ways of Operation: Polling versus Interrupts
The serial interface can be read and written in two different ways:
•
Polling: The input register is read periodically for new data.
•
Interrupts: The input register generates an interrupt in case that there is new data available.
The ISR (see Chapter
) then is called and in there the data are sent. This method is more
efficient but more complex.
4.6.2 Using Polling
Configuration
The configuration is done with the
Settings Wizard
(see Chapter
for more information), shown
in Figure
Figure 4.3:
USART Configuration Wizard
Send Data
Copy the files
serial.c
and
serial.h
and use the function
int ser putchar (int c)
.
Listing 4.6:
Send Data
while
( ! ( USARTx
−
>
SR & USART FLAG TXE ) ) ;
// wait u n t i l ready
35
USARTx
−
>
DR = ( yourCharacter & 0 x1FF ) ;
// sends yourCharacter
28
STM32 Cortex-M3 Tutorial