23
RS-232 interface
The ATmega128 microcontroller has two USART ports which can be used to connect the minimodule with a
PC computer or other equipment equipped with a RS-232 port. Such a connection requires a level converter
based on a MAX232 or similar IC, connected to the TxD and RxD lines.
V+
2
C1+
1
C1-
3
C2+
4
C2-
5
V-
6
T1 IN
11
T2 IN
10
R1 OUT
12
R2 OUT
9
T1 OUT
14
T2 OUT
7
R1 IN
13
R2 IN
8
V
C
C
16
G
N
D
15
ST232
1
6
2
7
3
8
4
9
5
DB9F
GND
GND
GND
GND
GND
+5V
+5V
R
S
-2
32
PE1(TxD0) lub PD3(TxD1)
PE0(RxD0) lub PD2(RxD1)
100n
100n
100n
100n
Figure 15
Connection of the RS-232 to the MMnet102.
RS-485 interface
The RS-485 interface facilitates long-distance transmission in a difficult environment. An implementation of
this interface is as simple as that of RS-232 and requires only a line driver, e.g. MAX485. The feature
discerning this interface from RS-232 is the necessity to control the direction of action of the driver
(transmission/reception). This control is effected through the program, using any I/O pin of the microcontroller.
The 560R resistors visible in the diagram polarize initially the inputs, increasing the immunity to interference.
The 120R resistor connected by means of a shorting strap is used to match the interface to the line
impedance.
VCC
8
B
7
A
6
GND
5
RO
1
RE
2
DE
3
DI
4
MAX485
U8
Pxx
JP
1
2
3
B
A
GND
+5V
+5V
GND
GND
GND
560R
120R
560R
PE1(TxD0) lub PD3(TxD1)
PE0(RxD0) lub PD2(RxD1)
Figure 16
Connection of the RS-485 port to the MMnet102.