You are on page 1of 21

Laboratory work 2

Investigation of RS422/RS485 Serial Interfaces

Objectives
To understand how a differential interface works. To investigate
the RS422/RS485 data interface methods, identify their maximum
communication distance.

Basic knowledge and theory


To ensure data exchange between various telecommunications, auto-
mation, alarm systems, often wired line connections are used. To achieve
a reliable data transfer first you need to be well aware of the characte-
ristics of wired lines and select the appropriate standardized interface.
Most often, ensuring the maximum exchange rate and communication
distance is the top priority. The main limiting factor for communication
distance is the interference, which arises from the interaction between
lines and ground potential difference at the communication lines ends. In
practice, asymmetric and differential interfaces are used.
In asymmetric interfaces, a two-wire communication line is
used, where one line is connected to the ground. At the receiver end,
a useful signal is interpreted as a certain level (e.g. voltage) relative
to the ground. Also, an induced disturbance signal can be evaluated
as useful (Figure 2.1).
Advantages of asymmetric interfaces:
• simple scheme, because there is minimum connections;
• low cost.
Disadvantages:
• low resistance to interference;
• extensive high-frequency radiation;
• limited communication distance (interference between lines).

18
Figure 2.1. Signal in communication line, connected to the asymmetric
interface

Differential interfaces have higher resistance to interference. As


in an asymmetric interface, a two-wire communication line is used,
but here neither line is grounded. The original signal is sent via the
first line (e.g. line A), and an inverse signal is sent through the se-
cond line (e.g. line B). In phase disturbances that arise in the com-
munication lines are suppressed at the differential input. In phase
disturbance – a disturbance that affects both communication line
conductors equally. For example, an electromagnetic wave crosses
the communication lines and induces a potential that is equal in both
conductors. Usually communication line conductors are close to each
other, so we can assume that the induced disturbances are in phase.
Advantages of differential interfaces:
• high resistance to interference;
• low high-frequency radiation;
• increased transmission distance and exchange rate.
Disadvantages:
• increased cost;
• more expensive cable.
Resistance to interference in communication lines can be in-
creased by using twisted pair cables. Figure 2.3 shows the parasitic
current induction in a straight cable and compensation in a twisted
pair cable when they both are exposed to a magnetic field. Cur-
rents, induced in different sections of a straight cable, have the same
direction (Figure 2.3, a) so a parasitic current starts to flow in the
conductor. In a twisted pair cable, the induced currents in different
sections have the opposite direction to one another, so they compen-
sate (Figure 2.3, b).

19
Figure 2.2. Signal in communication line, connected to the differential
interface

magnetic field

straight cable
a
induced current

b
twisted pair cable

Figure 2.3. Parasitic current induced in a straight cable (a) and in a


twisted pair cable (b)

Communication lines parameters


Communication distance is limited not only by external inter-
ference, but also by cable and wire parameters. Common two-wire
communications line equivalent diagram is shown in Figure 2.4.
Equivalent line chart consists of the distributed inductance L, resis-

20
tance R, indicating resistive line impedance, the distributed capac-
ity C and conductivity G, indicating the line losses. These elements
depend on the length and therefore are marked by the nominal value
of the element per unit length, i.e.: nH/m pF/m Ω/m and S/m.

R/2 L/2 L/2 R/2

C G
R/2 L/2 L/2 R/2

Figure 2.4. A communication line equivalent diagram

R/2 L/2 L/2 R/2

C G

Figure 2.5. Asymmetric communication line equivalent circuit

During asymmetric exchange, one of two-wire line conductors


are connected to the ground and the R and L parameters can be ig-
nored. Then we analyze the communication line equivalent scheme
shown in Figure 2.5.
The full resistance (impedance) of this line can be calculated by
the following expression.

21
jZ L  R
Z . (2.1)
(2.1)
jZC  G

hereωZisisthe
Here theangular
angularfrequency.
frequency.
Wecancansee
see that jZ Lresistance
R
We that thethe Zline
line fullfull
resistance depends
. depends on frequen-
on the the frequency.
(2.1) At hig
10At
cy. Khz) thefrequencies
higher resistance of(greater jZ
the coil, C  G
compared
than 10 KHz)tothe theresistance
wire resistance
of the r, is growin
the line also
coil, compared increases due to parasitic
R, is growing rapidly. The also
capacitance. it is per- growing mo
here Z istothetheangular
wire resistance
frequency.
conductance
meability G.line
therefore, when the to frequencies are high, r Itand is G can At
be ig
We of
canthesee also
that theincreases
line fulldue parasitic
resistance capacitance.
depends on the frequency. hig
line
also impedance
growing more can be calculated
rapidly compared by the
to following
the expression:
conductance G. There-
10 Khz) the resistance of the coil, compared to the wire resistance r, is growin
fore,
the when the frequencies
line also increases due are high, LR and Gcapacitance.
to parasitic can be ignored.
it isThen
also growing m
the transmission line impedanceZ AD can be. calculated by the following (2.2)
conductance G. therefore, when the C frequencies are high, r and G can be ig
expression:
line impedance can be calculated by the following expression:
L
Z AD . (2.2)
(2.2)
C

Here the impedance is a real number and is independent of the


frequency.

RS485, RS422 interfaces


RS485 and RS422 interface are popular differential interfaces,
which are widely used in industrial automation, security and fire
alarm systems. These interfaces have all the benefits and features of
a differential data transmission mode and they allow devices to be
connected to networks.
RS422 is full duplex interface. The data is transmitted and re-
ceived using separate wire pairs, i.e. to connect two devices a four-
wire connection cable is needed. RS485 uses half-duplex mode.
Data transmission and reception takes place at different points in
time using one wire pair. RS422 and RS485 transmitter / receiver
schemes are shown in Figure 2.6.

22
rs485
rs422

Y A
di d
di d
Z de
re
A
rO r
rO r
B
B

b
a
Figure 2.6. RS422 (a) and RS485 (b) transmitter / receiver schemes

Here:
D – driver;
R – receiver;
DI – driver input;
RO – receiver output;
DE – driver enable;
RE – receiver enable;
A – direct differential input / output;
B – reversal of differential input / output;
Y – direct differential output (RS422);
Z – reversal of differential output (RS422).
Additional control is needed for the transmitter / receiver when
using RS485 interface. When data is being transmitted, the receiver
must be switched off and when data is being received, the transmit-
ter should be powered off. Signals RE and DE are used for this. You
can connect the signals DE and RE and control the transmitter-re-
ceiver with a single signal.
RS422 and RS485 bus schemes are shown in Figure 2.7a and
2.7b. When using RS422, a single transmitter can be connected to
10 receivers. RS485 interface can be realized between 32 receivers
and transmitters in half-duplex mode. Resistors are connected at the
line ends for better performance (Rt = 100 ... 120 Ω).

23
It should be noted that the RS422 and RS485 standards do not
normalize information frame format and exchange protocol. The
most commonly used frame format is as in RS232 standard (the start
bit, data bits, parity bit (if needed) and stop bit). Most of the exchange
protocol is based on “master-slave” basis. One of the bus devices is
“master” and the others are “slaves”, which have different logical ad-
dresses. One of the most popular protocols is Modbus RTU.

rs485
A A
rt rt
B B

r r
d d
a

rs422
d rt

r r r
b

Figure 2.7. RS485 (a) and RS422 (b) bus schemes

The main parameters of RS422 and RS485 interfaces are shown


in Table 2.1.

24
Table 2.1. The main parameters of RS422 and RS485 interfaces
Standard interface parameters RS422 RS485
Maximum number of transmitters /
1/10 32/32
receivers
Maximum cable length (link distance) 1200 m 1200 m
The maximum data exchange rate 10 Mb/s 10 Mb/s
Transmitter logic “1” level +2...+10 V +1,5...+6 V
Transmitter logic “0” level –2...–10 V –1,5...–6 V
Receiver input voltage range –7...+7 V –7...+12V
Receiver insensitivity range ±200 mV ±200 mV

Work procedures and tasks


An RS232–RS422/RS485 interface converter stand will be
used in this laboratory work, which diagram is shown in Figure 2.8.
The stand is made up from two RS232–RS422/RS485 interface
converters U1 and U2, automatic 230 V power circuit breaker QF1,
switching block X1 and a connection block X2, used for connecting
to the computer sound card. Signal suppression tests are done by
using two two-wire line equivalent control block, which allows the
simulation of 200 m to 1600 m in length (200 m step change) cat-
egory 5e cable settings. The equivalent control block is made up of
discrete components. Its scheme is shown in Figure 2.4. To analyze
and monitor the signal waveform, a computer’s sound card is used.
The signal connection to the sound card linear input is done by us-
ing a special cable.

Attention! Converters are powered from 230V AC power sup-


ply rails and therefore any cable switching action or converter
configuration changes must be made only when the power supply
is turned off!

25
converter u1 converter u2

5 10

T-/R-

T-/R-
8

8
4 9

T+/R+

T+/R+
rs232

rs232
7

7
3 8 1 2 3 4 5 6 7 8 9 10

GND

GND
dB9F

dB9F
6

6
2 7 1 2 3 4 5 6 7 8 9 10 X1
R-

R-
5

5
1 6
rs422/rs485

rs422/rs485
R+

R+
4

4
4 9 3
3

3
1 2 3 X2
2

2
~220V

~220V
1

1
QF1

~230V
50hz

Figure 2.8. RS232–RS422/RS485 interface converter stand connection


scheme

In this laboratory work, RS422 and RS485 interfaces data ex-


change tests are performed. Phases of the study:
1. RS422 interface data exchange study:
• converter configuration and connection establishment;
• data transfer rate test;
• determining the maximum communication distance.
2. RS485 interface data exchange study:
• converter configuration and connection establishment;
• data transfer rate test;
• determining the maximum communication distance.
3. RS485 interface waveform in the communication line ana-
lysis.

1. RS422 interface data exchange analysis


Set the converter in full duplex mode and direction control to
automatic. This requires changing the micro switches inside the
converter in accordance with Table 2.2.

26
Table 2.2. RS422 mode settings for the micro switches
Switch 1 Switch 2 Switch 3
S1.1 Off S2.1 Off S3.1 Off
S1.2 Off S2.2 On S3.2 On
S1.3 Off S2.3 Off S3.3 Off
S1.4 On S2.4 On S3.4 On
S2.5 On S3.5 Off
S2.6 Off S3.6 On
S2.7 Off S3.7 Off
S2.8 On S3.8 On

U1 converter must be connected to the COM1 port on the com-


puter, the inverter U2 to COM2 port. Using the connection cable,
connect the converters as shown in Figure 2.9 (RS422 standard). All
connections must be made in switching block X1.

converter u1 converter u2
T-/R-

T-/R-
8

rs232
T+/R+

T+/R+
rs232

7
GND

GND
dB9F

dB9F
6

6
R-

R-
5

5
rs422/rs485

R+

R+

rs422/rs485
4

4
3

3
2

2
~220V

~220V
1

Figure 2.9. RS422 interface converter connection scheme

Turn the switch QF1. The PWR LED should ignite at both con-
verters.

27
All data transmissions will be carried out by using the
HyperTerminal program. It can be activated by following these
steps: Start→Accessories→Communications→HyperTerminal.

Figure 2.10. Hyper Terminal Location Information main window

A window (shown in Figure 2.10) should open. There, press the


Cancel button. After clicking the Cancel button, the program may
require additional confirmation, so at the confirmation window se-
lect the YES button.

Figure 2.11. Confirmation window

28
Figure 2.12. Additional information window

Next, the program requests to establish a new connection. For


this, it is necessary to enter the name of the connection, such as
Com1_9600 and press the OK button.

Figure 2.13. Creation of a new connection

After clicking the OK button, the HyperTerminal program will


open the Location Information window. Select the Cancel button,
then confirm the refusal and close the additional information win-
dow.
In the next window, select COM1 port and click OK.

29
Figure 2.14. Port selection window

Click the OK button. The program will enter the setup screen
where you must select a transfer speed of 9600 bps and disconnect
the flow control Flow Control function.

Figure 2.15. PC COM1 port setup window

30
Click the OK button. The light-emitting diodes DCD, DTR,
RTS and CTS must ignite and the main HyperTerminal program
window becomes the COM1 port monitoring window.
Re-activate the HyperTerminal program and repeat all the con-
figuration steps, but instead of selecting COM1 port, select COM2
port. Both port terminals on the computer screen can be positioned
as shown in Figure 2.16.

Figure 2.16. Both port terminal windows

Choose one of the HyperTerminal windows and make it active.


Press keys on the keyboard (preferably letter) and watch as the sym-
bols appear in the next window. In this way, the data is sent from
one COM port to another.
Try to transfer a small file (from 10 KB to 50 KB). This can be
done by clicking the right mouse button on one of the HyperTermi-
nal windows and selecting Receive File.

31
Figure 2.17. Receive File window

At the Receive File window, specify a location on the hard disk,


where the received file will be saved and press the Receive button.
At the other HyperTerminal window, click the right mouse but-
ton and select Send File. Specify the file location, protocol (Figu-
re 2.18) and click Send.

Figure 2.18. Send File window

Change the data transmission speed, measure the time it takes


for the data to be sent and calculate the actual speed of data transfer
from one terminal to another. Write the result in Table 2.3. Data
transfer rate at both terminals can be changed by following these
steps: press the Disconnect button, enter menu File→Properties,
click Configure and change the data transfer rate.

32
Table 2.3. RS422 interface data transfer results
Transmission Actual transfer
File size Transfer time
rate speed
1200 b/s
9600 b/s
38400 b/s
57600 b/s

Instead of the normal connection cable, connect the long-line


equivalent. Set the transfer rate to 9600 b/s. In the line equivalent
block, set both wire pair lengths to 1600 m. Try to transmit data
through by using the keyboard.
Set the transfer rate to 115200 b/s. By sending data through
the keyboard and changing the lengths of the two twisted pairs, de-
termine the maximum communication distance. If the sent and re-
ceived symbols do not match, data was transmitted incorrectly.

2. RS485 interface data exchange analysis


Turn off the workstation stand and change the mode converter
to RS485. This requires switching the micro switches as shown in
Table 2.4.

Table 2.4. RS485 mode settings for the micro switches


Switch 1 Switch 2 Switch 3
S1.1 Off S2.1 Off S3.1 Off
S1.2 Off S2.2 On S3.2 Off
S1.3 Off S2.3 Off S3.3 On
S1.4 On S2.4 On S3.4 Off
S2.5 On S3.5 On
S2.6 Off S3.6 Off
S2.7 Off S3.7 On
S2.8 On S3.8 On

The converters are connected by using the connecting cable as


shown in Figure 2.19.

33
T-/R-

T-/R-
8

rs232
T+/R+

T+/R+
rs232

7
GND

GND
dB9F

dB9F
6

6
R-

R-
5

5
rs422/rs485

R+

R+

rs422/rs485
4

4
3

3
2

2
~220V

~220V
1

1
Figure 2.19. RS485 interface converter connection scheme

Try to transfer data from one terminal to another by using the


keyboard. If the data is transmitted without error, change the trans-
fer rate and transfer the same file as in RS422 mode. Write the re-
sults to Table 2.5.

Table 2.5. RS485 interface data transfer results


transmission Actual transfer
File size Transfer time
rate speed
1200 b/s
9600 b/s
38400 b/s
57600 b/s

3. RS485 interface waveform analysis


Instead of the connection cable, use a cable which allows sig-
nals from the interfaces to be sent to the computer sound card linear
input and connect it to the switching terminal, as shown in Figu-
re 2.20.

34
converter u1
Orange with a white stripe
sound card

T-/R-

line in
Blue with a white stripe

T+/R+
rs232

7
Green

GND
dB9F

6
R-

5
rs422/rs485

R+

4
3
2
~220V

Figure 2.20. Sound card input Line In and converter U1 connection


scheme

Green wire (GND, signal ground) should be connected to ter-


minal 3, orange with a white stripe (left channel) to terminal 4, and
blue with a white stripe (right channel) to the 5 terminal.
Set the data transfer rate to 9600 bps. Open the CoolEdit 2000
program. In the program menu toolbar, select File→New. In the
newly opened window set the parameters as shown in Figure 2.21
and press the OK button.
Activate the recording mode by pressing the recording button
at the bottom . Then press the keyboard several times. Stop the
CoolEdit 2000 program recording mode by pressing the stop button
. Using the CoolEdit 2000 tools find the ASCII symbols (the
ones that you pressed) T+ ir T– signals, that are referenced to the
ground. Save the results for the laboratory work report.
For the signal dampening in the communication line analysis,
connect the converters by using the long line equivalent and connect
the sound card linear input so that you can monitor signals before
and after they pass the long line equivalent. Connection scheme is
shown in Figure 2.22.

35
Figure 2.21. CoolEdit 2000 signal parameter window

converter u1 converter u2
T-/R-

T-/R-
8

rs232
T+/R+

T+/R+

communication
rs232

line equivalent
GND

GND
dB9F

dB9F
6

6
R-

R-
5

5
rs422/rs485

R+

R+

rs422/rs485
4

4
3

3
2

2
~220V

~220V
1

Orange with a white stripe


sound card
line in

Blue with a white sttripe

Green

Figure 2.22. Signal dampening in the communication line


analysis scheme

36
Connect the sound card cable to terminal block X2. Green wire
must be connected to terminal 3, the orange with a white stripe to ter-
minal 1, and blue with a white stripe to terminal 2. When sending data
from COM1 to COM2, record the signals with CoolEdit 2000 program.
Set the data transfer rate to 9600 bps and the communication distance to
200 m, 800 m and 1600 m. Save results for the laboratory work report.

Content of the report


1. Objectives of the work.
2. RS422 interface data exchange analysis (section 1).
3. RS485 interface data exchange analysis (section 2).
4. RS485 interface waveform and signal dampening analysis
(section 3).
5. General conclusions of the work.
6. Answers to review questions and tasks.

Review questions and problems


1. Explain the differential data exchange principle.
2. List the differential data transmission methods and their ad-
vantages and disadvantages.
3. Why twisted pair cables are more resistant to interference?
4. Give a wired communication line equivalent scheme and ex-
plain the meaning of its elements.
5. Explain the RS422/RS485 interface operation, and name
their main differences.
6. Give and explain the RS422 and RS485 bus schemes.
7. List the main RS422 and RS485 interface parameters.
8. Do RS422 and RS485 standards provide a possibility to iden-
tify peripheral devices on their bus?
9. What may be the maximum number of peripheral devices in
RS422 and RS485 bus?
10. How the reception and transmission mode switching is con-
trolled in RS485 interface?

37
Literature
RS485, specifications and in depth tutorial [interactive], [watched
2011 06 02]. Access through the internet: <http://www.lammert-
bies.nl /comm/info/RS-485.html>.
EIA422 Bus Interface Description, RS422 [interactive], [watched
2011 06 02]. Access through the internet: <http://www.interface
bus.com/Design_Connector_RS422.html>.

38

You might also like