The text of a manual · part 15 of 17
RM14K Installation and Programming Manual, pages 139 to 148
Pages 139 to 148 of 164
The original document is the PDF (600 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the Square D 8030 CRM-510 and Schneider 8030 CRM-510
Page 139
Table B-1
25 pin RS-232 port
Pin
Name
DTE/DCE
1
CG
<--->
Frame Ground
2
TD
--->
Transmitted Data
3
RD
<---
Received Data
4
RTS
--->
Request to Send
5
CTS
<---
Clear to Send
6
DSR
<---
Data Set Ready
7
SG
<--->
Signal Ground
8
DCD
<---
Data Carrier Detect
<---
Positive DC Test Voltage
9* 10*
Function
<---
Negative DC test Voltage
11*
QM
<---
Equalizer Mode
12+
SDCD
<---
Secondary Data Carrier Detect
13+
SCTS
<---
Secondary Clear to Send
14+
STD
--->
Secondary Transmitted Data
15#
TC
<---
Transmit Clock
16+
SRD
<---
Secondary Receive Data
17#
RC
<---
Receive Clock
18*
DCR
<---
Divided Clock Receiver
19+
SRTS
--->
Secondary Request to Send
20
DTR
--->
Data Terminal Ready
21*
SQ
<---
Signal Quality Detect
22
RI
<---
Ring Indicator
<---
Data Rate Selector
--->
Data Rate Selector
--->
Busy
23* 24* 25*
SCTE
In the above table, the character following the pin number means: * rarely used + used only if secondary channel implemented # used only in synchronous interfaces Although originally all DB25 RS-232 ports were female, most personal computers which have a DB25 RS-232 connector use a male connector. The female DB25 connector on a personal computer is most likely the parallel printer port and should never be connected to any RS-232 device. As is indicated above, the 25 RS-232 standard has the option of 2 data channels, each with their own handshake lines, and the option of synchronous link. These functions are rarely used and have been left off of the newer 9 pin ports.
RM14K Manual
B
Serial Communication Overview 139
Page 140
Table B-2
Type A
9 pin RS-232 port
Pin
Name
Function
1
DCD
Data Carrier Detect
2
TD
Transmitted Data
3
RD
Received Data
4
DTR
Data Terminal Ready
5
SG
Signal Ground
6
DSR
Data Set Ready
7
RTS
Request to Send
8
CTS
Clear to Send
9
RI
Ring Indicator
Table B-3
Type B
9 pin RS-232 port
Pin
Name
Function
1
DCD
Data Carrier Detect
2
RD
Received Data
3
TD
Transmitted Data
4
DTR
Data Terminal Ready
5
SG
Signal Ground
6
DSR
Data Set Ready
7
RTS
Request to Send
8
CTS
Clear to Send
9
RI
Ring Indicator
The TYPE B connection is the most common on 9 pin personal computer ports. These ports are usually male connectors. Determining the type of 9 pin RS-232 port with a voltmeter. It is possible to determine the type of port with the use of a voltmeter using the following procedure: 1
Set the voltmeter for DC volts, 30 volt range. The voltage being read likely be negative and be within the range of +3VDC to -15VDC.
2
Power up the equipment.
3
Place the negative probe (black) of the voltmeter on the SG pin of the port. (Pin 7 of a DB25 port or pin 5 of a DE9 port)
4
Place the positive probe (red) of the voltmeter on pin 2.
5
Write down that voltage; including algebraic sign or polarity.
6
Place the positive probe (red) of the voltmeter on pin 3.
7
Write down that voltage.
The TX voltage is within the range of -15V to -5V. The RX voltage is within the range of -3V to +3V. Therefore, if pin 2 is the more negative voltage of the two, the serial port is TYPE A. If pin 3 is the more negative voltage, the serial port is TYPE B.
140 Serial Communication Overview
B
RM14K Manual
Page 141
Since almost every device that is not a modem is a DTE, it is quite common to connect DTE to DTE without a modem pair. A "null modem" connection has been established to simplify this situation. It simply reverses the transmit and receive connections from one side of the connector to another and jumpers some of the hardware handshake lines.
Straight through cable Terminal DTE
Terminal DTE
Null Modem
Figure B-2 Null Modem connection The null modem is frequently a small enclosure with one male connector and one female connector. Sometimes the null modem is built into a single cable to connect the DTE device to another DTE device. In addition to the crossing of the transmit and receive pins, some additional connections to the hardware handshake pins is usually made the pinouts of null modems for 25 pin and 9 pin connections are shown below. Table B-4 Male Connector
Female Connector
1
1
2
3
3
2
4
5
5
4
6
20
8
6
20
8
7
7
Table B-5
RM14K Manual
DB25 Null Modem
DE9 Null Modem
Male Connector
Female Connector
2
3
3
2
5
5
7
8
8
7
1
4
6
1
4
6
B
Serial Communication Overview 141
Page 142
Electrical characteristics of RS-232 The RS-232 interface is an Single-Ended driver with an open ended receiver. The driver asserts a voltage between -5V and -15V relative to the Signal Ground to represent the MARK state (Logic TRUE). The driver asserts a voltage between +5V and +15V relative to the Signal Ground to represent a SPACE state (Logic FALSE). The fact that there may be a 30 volt swing between MARK and SPACE conditions may lead to problems with the slew rate of the signal due to the capacitance of the cable. If the cable run is long and communication problems are occurring, try lowering the baud rate.
RS-422 The RS-422 interface uses a closed ended driver and a closed ended receiver. The RS-232 interface is ground referenced. This can cause trouble in situations where a common mode induced noise may severely affect the signal by changing the reference. A better solution for noise immunity is to convert the ground referenced data at the transmission end into a differential signal and transmit this down a balanced, twisted-pair line. At the receiving end any induced noise voltage will appear equally on each line. If the receiver only looks at the differential signal, any induced common mode voltage will be rejected. This is the idea behind the RS-422 and RS-485 standards. The RS-422 interface typically used in a point to point connection using a pair of wires from the transmitter of Unit 1 to the receiver of the Unit 2. Another pair of wires is from the transmitter of Unit 2 to the receiver of Unit 1. This connection allows for full duplex operation, i.e. the units can transmit messages while they are receiving messages. The Square D SY/MAX family of PLCs us RS-422 communication. Their standard pinout is as follows: Table B-6
SY/MAX DE9S RS-422 Pinout
Pin Function
Description
1
TX -
Transmit Data from device. (Data OUT) (inverted)
2
TX+
Transmit Data from device. (Data OUT) (non-inverted)
3
RX-
Receive Data (Data IN) (inverted)
4
RX+
Receive Data (Data IN) (non-inverted)
5
CTS-
Clear to Send (inverted)
6
RTS-
Request to Send (inverted)
7
CTS+
Clear to Send (non-inverted)
8
RTS+
Request to Send (non-inverted)
9
Shield
Shield Ground. AC coupled to chassis.
TX Unit 1
+
+
-
+ -
RX
+ -
RX TX Unit 2
Figure B-3 RS-422 Setup Like RS-485, the RS-422 protocol may be used in a multidrop configuration as shown in Figure B-4. The RS-485 standard requires a minimum capability of 32 receivers on the network. The RS-422 standard places no minimum requirement and therefore is typically used in point to point or as the host of a RS-485 network.
142 Serial Communication Overview
B
RM14K Manual
Page 143
Always connect the + terminals on the TX to the + terminals on the RX. Similarly, connect the - terminals on the TX to the - terminals on the RX. Note: Occasionally the manufacturer incorrectly labels the polarity of the connections. If the system is not working try exchanging the polarity of the TX pair and the RX pair on the host. With the high noise immunity and low voltage swings, the RS-422 interface may have long runs of up to 10,000 feet. Electrical Characteristics of RS-422. The driver asserts a positive voltage across the receiver to represent a MARK state, a negative voltage to represent the SPACE state. The receiver triggers off of the transition through the zero voltage point.
RS-485 (four wire) The RS-485 interface is functionally like the RS-422 interface with the exception that the transmitters are able to tri-state, i.e. float. This allows multiple transmitters to be connected to a host receiver. The previously mentioned minimum transmitter requirements allows multiple receivers to be connected to a host transmitter. This technique is called multidropping and is shown in Figure B-4. Square D PowerLogic Circuit monitors use this type of RS-485 for communication.
Host TX Unit 1
RX
+
+
-
+ -
+ -
The terminator on the Host may not be required if the Host is a RS-422 port with internal biasing. All Niobrara RS-422 ports have the proper internal biasing for this type of setup.
RX TX Unit 2
+
RX
+ -
TX Unit 3
+ Terminator
RX
+ -
TX Unit 4
Figure B-4 RS-485 Four Wire Setup As shown in Figure B-4, it is possible to use a 4 wire RS-422 port to drive a 4 wire RS-485 multidrop network. If the RS-422 port does not have internal biasing on the RX pair it may be necessary to add a terminator to that end of the network. The terminator is a resistor correctly matched to the line which reduces reflections on the network.
RS-485 (two wire) Another version of the differential communication system is the RS-485 two wire network. The two wire system is a half-duplex connection where each unit transmits and receives on the same pair of wires. Only one transaction may occur on the network at one time as opposed to the four wire system where the units may transmit while they are receiving. The two wire system is inexpensive to install because only one twisted pair cable is needed and flexible because peer-to-peer protocols are possible. Throughput is potentially lower than with full duplex standards such as RS-422. All the + terminals are
RM14K Manual
B
Serial Communication Overview 143
Page 144
connected together, all the - terminals are connected together. A terminating resistor is usually required on each end. Since each unit can listen to the transmissions of every other unit on the network, peer to peer communication is available. The trade off is that the half-duplex connection has half of the throughput of the full duplex four wire system. A typical installation is shown in Figure B-5.
The Allen-Bradley® Data Highway is an example of a two wire RS-485 multidrop network.
TX/RX
+
+
-
-
TX/RX
Unit 1
Unit 2
+ -
TX/RX
Terminator Unit 3 + -
TX/RX Unit 4
Figure B-5 RS-485 Two wire Multidrop Setup Note: Occasionally the manufacture incorrectly labels the polarity of the connections. If the system is not working try exchanging the polarity of the TX/RX pair on the unit.
20mA Current Loop The 20mA Current Loop is another multidrop configuration with historical roots in manual telegraphy.. The transmitting mechanism may be explained as simply opening a normally closed switch for the data bit transmission. The receiver is usually a optical isolator (LED/phototransistor) unit. Each loop is powered by a Constant Current Source. The source may be part of one of the units or may be a separate device as shown in Figure B-6. As in other multidrop schemes, each unit watches the RX line for its messages with its address. The number of units on the network is dependent upon the addressing scheme as well as the voltage supply of the constant current source. Each RX receiver on the circuit will cause a voltage drop in the supply current. The series sum of these drops must be a value less than the available voltage from the current supply or none of the receivers will work. To check, add up the voltage drops around the loop and make sure that the sum is less than the compliance voltage of the current source. Some Telemechnique TSX processors and some Red Lion Controls equipment such as the Apollo message centers use a 20mA current loop for serial communication.
144 Serial Communication Overview
B
RM14K Manual
Page 145
-
+
+ +
-
-
+
TX switches are normally closed to allow current flow. The switch is opened for data bit transmission.
+
Host
TX RX
Unit 1
RX TX Unit 2
RX
-
TX Unit 3
+ Constant Current Source
+ + -
+ RX
-
TX
+
Unit 4
Figure B-6 20mA Current Loop (Full Duplex) A half-duplex 20mA current loop may be formed by connecting the a single current supply through all RX and TX connections in series, thus only receivers are current sources.
Hardware Handshaking Sometimes it is necessary for the transmitting and receiving devices to signal each other to control the flow of data. This may be done with special characters in the software (see Software Handshaking on page 148.) or with physical connections to the hardware. This physical signaling system is known as hardware handshaking. The electrical characteristics of the handshaking lines are the same as the TX/RX lines of the system. It may be a single-ended, ground referenced signal in RS-232, or a differential pair in RS-422 or RS-485. The two most common types of hardware handshaking are: Request to Send (RTS) and Clear to Send (CTS). Request to Send (RTS) is employed in two different modes: Request to Send (also known as Push to Talk) and Restraint. This technique is also called "Flow Control". Request to Send (Push to Talk) mode is used by the transmitting device to signal the receiving device that it has data to send. This is typically used in modem and radio modem setups. When the transmitting device has data to send, it asserts its RTS. When the modem is ready, it asserts the CTS of the transmitting device to allow it to transmit. The transmitting device will keep RTS asserted until it has sent all of its data. Push to talk mode is the original mode of the RS-232 standard for connecting DTE to DCE. This mode of RTS usage is not commonly used in most serial communication situations and is usually restricted to modems and radios. Restraint mode is used by the receiving device to signal the transmitting device that it is sending data too quickly for to be processed. When this situation occurs, the receiving device negates its RTS to signal the transmitting device to stop. When the receiving device has "caught up" it asserts its RTS line to signal the transmitting device to continue. Restraint mode is the most common handshaking mode.
RM14K Manual
B
Serial Communication Overview 145
Page 146
Sometimes if two RS-232 DTE devices are connected together, the DTR pin may be used as the restraint handshake line instead of RTS.
Clear to Send (CTS) is used to signal the transmitting device that the receiving device is ready to accept data. The transmitting device will not send data until its CTS is asserted. In a typical hardware handshaking application RTS on the one device is usually connected to CTS on the other. The vast majority of cases do not require active hardware handshaking. In this case it is common to jumper the RTS of each unit to its own CTS. This will allow each port to transmit at will. Data Terminal Ready (DTR) is also often used as a restraint output of DTE such as a printer.
Software Overview Binary Representation of Data With the implementation of an appropriate hardware system, a uniform system must be implemented to allow the data to be transferred. In a synchronous serial system, each bit of data is transferred with a clock signal. This ensures that the receiving device "knows" when each bit is transferred so it can reconstruct the data. The throughput is determined by the number of data bits and the clock frequency. The data synchronization is accomplished by the transmission of a sync character which is an out-of-band character. The more common type of serial communication is asynchronous. In an asynchronous system the character timing is determined by a local clock at each end. This clock usually runs at 16 times the baud rate. Each bit is to stay in its MARK or SPACE state for the time determined by the baud rate. Data is transmitted in packets of the following form: Start bit; Data Bits, Parity Bit, Stop Bits.
Start Bit The Start bit is always a SPACE bit and signifies the beginning of the data packet.
Data Bits Typically 7 or 8 bits. On rare occasions may be 5 or 6 bits. The if the data is logic true it is in the MARK state. If the data is false it is in the SPACE state. The data is transmitted LSB first.
Parity Bit The parity bit is an error detection bit that follows the last data bit. Its determination is based upon the type of parity selected. The most common types are ODD, EVEN, NONE, MARK, and SPACE. These parity selections are calculated as follows. Odd: The parity bit is set to the MARK state if the number of data bits in the MARK state are even. Therefore the total number of data bits in the MARK state including the parity bit is an ODD number. Even: The parity bit is set to the MARK state if the number of data bits in the MARK state are odd. Therefore the total number of data bits in the MARK state including the parity bit is an EVEN number. None: No parity bit. The stop bit comes immediately after the last data bit. Mark: Always logic high. Like an additional stop bit. The mark parity bit is usually used in conjunction with 7 bit ASCII data. Space: Always logic low. The space parity bit is usually used in conjunction with 7 bit ASCII data.
Stop Bit The Stop bit is always a MARK bit. There is always one stop bit, sometimes two stop bits, and on rare occasions 1.5 stop bits. The receiving device starts timing for the next start bit half way through the last stop bit in the message. A message with two stop bits is the same as a message with one stop bit plus
146 Serial Communication Overview
B
RM14K Manual
Page 147
one extra bit time worth of dead space between packets. Therefore a device set for 1 stop bit can also receive a message with 2 stop bits. A character without a valid stop is called a "Framing Error". It is worth noting that the total number of bits in a packet is sometimes used to reference the type of communication. For instance, Square D SY/MAX packets have: 1 start bit + 8 data bits + 1 parity bit + 1 stop bit = 11 bits. Most Hayes modems can only handle a 10 bit protocol. Now this may be: 1 start bit + 8 data + 0 parity + 1 stop = 10 bits or 1 start bit + 7 data + 1 parity + 1 stop = 10 bits or 1 start bit + 7 data + 0 parity + 2 stop = 10 bits Since the Hayes modem is designed to handle only 10 bits per character, this explains why it is not possible to send an 11 bit protocol like SY/MAX across these modems. The bit count gets off when the 10th bit arrives at the modem and the modem expects a start bit instead of the stop bit. An 11 bit modem is required for this type of communication.
Message Determination With the above descriptions of an asynchronous serial packet, binary data may be sent from one device to another.
Hexadecimal numbers Binary representation is somewhat cumbersome to deal with so hexadecimal numbers are often used. Hexadecimal (hex) numbers are base sixteen numbers. There are 16 digits in hex, the ten decimal digits 0 through 9 plus the six letters A through F which represent the decimal numbers 10 through 15. The following is a table of the decimal numbers 0 through 31, their hexadecimal equivalent and their binary equivalent.
RM14K Manual
B
Serial Communication Overview 147
Page 148
Table B-7
Decimal, Hex, Binary
Dec
Hex
Binary
Dec
Hex
Binary
0
0
0000
16
10
0001 0000
1
1
0001
17
11
0001 0001
2
2
0010
18
12
0001 0010
3
3
0011
19
13
0001 0011
4
4
0100
20
14
0001 0100
5
5
0101
21
15
0001 0101
6
6
0110
22
16
0001 0110
7
7
0111
23
17
0001 0111
8
8
1000
24
18
0001 1000
9
9
1001
25
19
0001 1001
10
A
1010
26
1A
0001 1010
11
B
1011
27
1B
0001 1011
12
C
1100
28
1C
0001 1100
13
D
1101
29
1D
0001 1101
14
E
1110
30
1E
0001 1110
15
F
1111
31
1F
0001 1111
Notice that it takes four binary digits makes one hex digit. Conversion from binary to hex is straight forward and explains why hex is so popular in PLCs. Since the most PLC devices use 16-bit registers it takes 4 hex digits to represent one register i.e. 1A2F (the 16-bit binary pattern 0001 1010 0010 1111). The first two characters "1A" make up the most significant byte (8 bits) and the last two characters make up the least significant byte.
ASCII characters ASCII is a set of 7-bit characters used in communication, computers and programmable logic controllers. The word ASCII is a acronym for American Standard Code for Information Interchange. ASCII is a way to interpret 7 bits (or 8 bits with a leading 0) as alphanumeric characters. There is an ASCII table following this section for your reference. In ASCII. the small letter "p" is represented by the binary number 0111 0000. This is the hexadecimal number 70 or the decimal number 112. Similarly, the capital letter "E" is represented by the binary number 0100 0101 which is the hexadecimal number 45 or the decimal number 69.
Software Handshaking It is common for communicating devices to need to exert control over each other. Typically the receiving device will need to force the transmitting device to stop and wait for it to catch up. This may be done at the hardware level (See Hardware Handshaking on page 145.) or at the software level using special characters. A common way for devices communicating with ASCII is to use the X-ON/X-OFF characters.
X-ON The X-ON character is the ASCII character DC1, which has the decimal value 17, hex value 11, and may be generated by pressing Ctrl+Q.
148 Serial Communication Overview
B
RM14K Manual