page 28
UART via RS-232
The
UART
(universal asynchronous receiver/
transmitter) is one of the most common ways of
exchanging data between the MCU and peripheral
components. It is a serial protocol with separate
transmit and receive lines, and can be used for full-
duplex communication. Both sides must be initialized
with the same baud rate, otherwise the data will not be
received correctly.
RS-232 serial communication
is performed through a 9-pin
SUB-D connector and the microcontroller UART module. In
order to enable this communication, it is necessary
to establish a connection between
RX
and
TX
lines on SUB-D connector and the same pins on
the target microcontroller using DIP switches.
Since RS-232 communication voltage levels
are different than microcontroller logic
levels, it is necessary to use a RS-
232 Transceiver circuit, such as
MAX3232
as shown on
Figure 8-1
.
9
10
11
12
13
14
15
16
1
2
3
4
5
6
7
8
C1+
V+
C1-
C2+
C2-
V-
T2OUT
R2IN
T1IN
T2IN
VCC
GND
T1OUT
R1IN
R1OUT
R2OUT
U1
MAX3232
5
9
4
8
3
7
2
6
1
1
5
9
6
CN19
RS-232 CONNECTOR
C7
100nF
C10
100nF
C12
100nF
C11
100nF
E1
10uF
VCC-3.3V VCC-3.3V
RX-232
TX-232
R22
100K
VCC-3.3V
1
2
3
4
5
6
7
8
O
N
SW3
G4.4
G4.5
DATA BUS
Figure 8-1: UART via RS-232
connection schematic
Enabling RS-232
In order to enable RS-232
communication you must push
SW3.6
(G4.4) and
SW3.7
(G4.5)
to
ON
position. This connects the
RX
and
TX
lines to appropriate
mikromedia
™
board UART module.
communica
tion