S ERIAL C O M M U N I C AT I O N

S ERIAL C O M M U N I C AT I O N

Serial communication , as the name implies, occurs in serial form through simple, twisted-pair cables. Serial data transmission is used for most periph- eral communication devices, since these devices are slow in nature and require long cable connections. Serial communication allows peripheral equipment, such as terminals, modems, operator interface panels, and line printers, to receive ASCII information.

Two of the most popular standards for serial communication are the RS- 232C and the 20 mA current loop. Other PLC standards are the RS-422 and RS-485, which improve performance and give greater flexibility in data communication interfaces.

The data communication links used with peripheral equipment can be unidirectional or bidirectional. If a peripheral is strictly either an input or an output device, then data transmission occurs in only one direction. In this case, a unidirectional serial signal line is all that is required to complete the link. Devices that serve as both input and output devices (e.g., video terminals) require bidirectional links. There are two ways to achieve this bidirectional communication. First, a single data line can be used as a shared communication line. The data can be sent in either direction, but only in one direction at a time. This operation is known as half duplex. If simultaneous bidirectional communication is required, two lines can connect the PLC to the peripheral. One line would be assigned permanently as an input, while the other would be a permanent output. This mode is known as full duplex. Figure 8-43 illustrates the unidirectional, half-duplex, and full-duplex communica- tion methods.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

Receiver Line

data transfer

Terminal Equipment

data transfer

Simultaneous two-direction

Terminal

data transfers

Figure 8-43. (a) Unidirectional, (b) half-duplex, and (c) full-duplex data commu-

nication formats.

EIA RS-232C. The EIA RS-232C is a proclaimed standard that defines the interfacing between data equipment and communication equipment that employs serial binary data interchange. This standard defines both the electrical signals and the mechanical details of the interface. A complete RS- 232C interface consists of 25 data lines, which encompass all of the possible signals for simple and complex communication interfaces. Although several of these lines are specialized and a few are undefined, most peripherals require only three to five lines to operate properly. Table 8-3 describes the 25 data lines as specified by the EIA.

Figure 8-44a illustrates an RS-232C data communication system using a telephone modem, while Figure 8-44b shows the RS-232C wiring connec- tions from a computer to a smart EIA PLC interface module. Figure 8-44c illustrates a typical RS-232C interface to a printer. Note that the communi- cation between a computer and a PLC has few lines swapped if no modem or other data communication equipment is used. This configuration is

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

Table 8-3. EIA RS-232C data line descriptions.

called a null modem cable. The connection between a PLC and an RS-232C peripheral (printer, etc.) usually requires four wires; however, the user should refer to the connection specifications for both devices for specific details.

The RS-232C standard calls for certain electrical characteristics. Some of these specifications are as follow:

• The signal voltages at the interface point should be a minimum of +5 V and a maximum of +15 V for logic 0; for logic 1, the minimum is –15 V and the maximum is –5 V.

• The maximum recommended cable distance is 50 feet, or 15 meters; however, longer distances are permissible provided that the resulting load capacitance, measured at the interface point and including the signal terminator, does not exceed 2500 picofarads.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

Telephone lines

Programmable Signal ground

Modem

Modem

Signal ground Computer

Controller

Transmit data

Transmit data

Request to send

Request to send

Receive data

Receive data

Data, set, ready Data set ready

Data, set, ready Data set ready

(a)

Ground

PLC’s

1 Computer

Smart

Transmit data

Transmit data

EIA

Receive data

Receive data

Interface

Request to send

Request to send

Clear to send

Clear to send

Carrier detect

Carrier detect

Data set ready

Data set ready

Ring indicator

Ring indicator

Data terminal ready

Data terminal ready

20 7 7 Signal ground 7 7

(b)

PLC’s

Receive Connector

+V –V Com User

DC Supply

(c)

Figure 8-44. RS-232C communication connections for (a)

a PLC to a modem, (b) a PLC to

a computer, and (c) a PLC to a printer.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

• The drivers used must be able to withstand open or short circuits

between pins in the interface. • The load impedance at the terminator side must be between 3000 and

7000 ohms, with no more than 2500 picofarads capacitance. • Voltages under –3 V (logic 1) are called mark potentials (signal

conditions); voltages above +3 V (logic 0) are called space voltages. The area between –3 V and +3 V is not defined.

Figure 8-45 illustrates a typical RS-232C serial ASCII pulse train. The transmission begins with a START bit (0) and ends with either one or two STOP bits (1). The transmission also includes parity, which can be even or odd (see Chapter 4 for parity).

EIA DATA

Start

Next Character S =123

LSB

MSB PAR Stop Stop Start 8

1 (–V) Mark

110 Baud

0 (+V) Space

2 Stop Bits

Next

All Other

Start

Baud Rates

1 (–V) Mark

0 1 1 0 0 1 0 1 0 1 1 Stop Bit

0 (+V) Space

Figure 8-45. RS-232C serial ASCII pulse train.

EIA RS-422. The RS-422 standard overcomes some of the RS-232C short- comings, including an upper data rate of 20K baud, a maximum cable distance of 50 feet, and an insufficient capacity to control additional loop-test functions for fault isolation. Like the RS-232C, the RS-422 standard still deals with the traditional serial/binary switch signals of two voltage levels across the interface. The RS-449 standard, which meets new operational requirements, defines the physical and mechanical specifications for the RS- 422 electrical interface standard.

The RS-232C is an unbalanced link communication method, meaning that it specifies a primary station that is always in control (master/slave relation- ship). This primary station is responsible for setting logical states and operational modes of each secondary station, thereby controlling the entire data communication process. The RS-422, however, is a balanced link in which either station can configure itself and initiate transmission when both stations have identical data transfer and link control capabilities. The RS-422 specifies electrically balanced receivers and generators that tolerate and produce less noise. These provide superior performance up to 10 megabaud (10,000 K baud).

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

A balanced circuit in an RS-422 configuration employs differential signaling over a pair of wires for each circuit, while an unbalanced configuration signal (RS-232C) uses one wire for each circuit and a common return circuit. Figure 8-46 illustrates configurations for both RS-422 and RS-232C circuits.

A A'

G Signal Wires

Circuit Ground

Circuit Ground

A'

RT T

Signal Wires

B'

(a) EIA RS-422 circuit

A Signal Wires

A'

Signal Ground

A'

Signal Wires

(b) EIA RS-232C circuit

Figure 8-46. Circuit configurations for (a) RS-422 and (b) RS-232C connections (G = generator; R = receiver; R T = optional cable termination; A, B, A', B' = interface points).

The RS-422 standard may be required when interconnecting cables are too long for effective unbalanced operation and noise in excess of 1 V can be measured across the signal conductors. The driver circuits for an RS-422 configuration are capable of furnishing the DC signal necessary to drive up to 10 parallel, connected RS-422 receivers. However, this capability involves considerations such as stub line lengths, data rate, grounding, fail-safe networks, etc. The standard does not specify cable characteristics, but to ensure proper operation, paired cables with metallic conductors should be employed and, if necessary, shielded.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

The maximum allowable cable distance for the RS-422 standard is a function of the data transmission rate. Figure 8-47 illustrates the relationship between distance and data rate. The graph describes empirical measures using a 24 AWG copper conductor and a twisted-pair cable with a shunt capacitance of 52.5 pF/meter (16 pF/foot) terminated in a 100 ohm resistive load. The balanced electrical characteristics of RS-422 perform even better with an optimal cable termination of approximately 120 ohms in the receiver load.

RS-422

RS-422 With Cable

1000 RS-422 Without Cable

Terminations Termination

15 RS-232C Cable Distance (meters) 10

1K 2.4K 4.8K 10K 20K 56K 100K 1M 2M 10M

Data Rate (bits/sec.)

Figure 8-47. Cable distance versus data rate relationship for the RS-422 and RS-

232C communications standards.

In reality, the curves in Figure 8-47 are conservative for RS-422 balanced operation. A cable can perform effectively, at lower data rates, at a distance of several miles with good engineering practice. However, if longer distances are required, the user should perform an analysis of the absolute loop resistance and the capacitance of the cable. In general, longer distances are possible when using 19 AWG cable, but the type and length of cable used must be capable of maintaining the necessary signal quality for the particular application.

The RS-449 mechanical standard, which supports the RS-422 electrical standard, offers several extra circuits (signals) that provide greater flexibility to the interface and accommodate new common return circuits. These additional functions and wires were beyond the capacity of an RS-232C 25- pin connector; therefore, the EIA selected a 37-pin connector for the RS-422 standard, because it satisfies interface channel requirements. If secondary channel operation is to be used as a low-speed TTY or acknowledgments channel, a separate 9-pin connector is also needed.

EIA RS-485. The RS-485 standard, like the RS-422, has dual transmitting and receiving lines (differential signals). This type of interface is best suited for industrial applications, because it provides better electrical isolation from the PLC or host than the RS-422 standard. It is also capable of being used in

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

a network (e.g., multiple transmitters and receivers operated on a common media, such as twisted-pair cable). Distances of up to 4000 feet (1200 meters) can be attained with this standard.

20 mA Current Loop. The 20 mA current loop de facto standard consists of four basic wires: transmit plus, transmit minus, receive plus, and receive minus. Figure 8-48 illustrates the four lines used to form the 20 mA current loop. This de facto standard is also referred to as a TTY serial interface.

Receive Amplifier

RL L or Sensor

Receive + Receive

Receive – Data

Figure 8-48.

20 mA current loop operation diagram.

In the 20 mA current loop standard, the opening and closing of current loops signifies 0s and 1s, respectively. When the current loop standard was first used in teletypewriters, rotating switch contacts in the sending teletypewriter connected and broke the loop; the corresponding 20 mA signal drove a print magnet in the receiving teletypewriter. Today, most 20 mA current loops electronically operate the opening switch and printer magnet arrangement.

To generate a current, the voltage in a 20 mA current loop is applied to a current limiting resistor at the data-sending end. This voltage is dropped across both the current limiting resistor (R TX ) and across the load resistor (R L ). The R values and the positive voltage applied to them must generate a flow current of 20 mA. Typically, a high voltage and high resistance (R TX ) are chosen, even though a low voltage and low resistance can be used. Current loop communications provide an advantage over other methods, since the wire resistance has no effect on the constant current loop. Voltage does not drop across the wire in current loop communications as it does in an RS-232C

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components Special Function I/O and C HAPTER 2 and Systems

Serial Communication Interfacing 8

voltage-oriented interface, thus allowing the current loop interface to drive signals longer distances. To avoid this voltage drop, a current loop uses a constant source to generate the 20 mA current.

Converting a 20 mA current loop to an RS-232C interface can be done simply by employing an RS-232C-level receiver. The receiver drives a switching transistor on the transmission end, and an optical isolator and load resistor drive the RS-232C driver on the receiving end.