The text of a manual · part 7 of 23
Bulletin 1771 Communication Controller Module (Cat. Nos. 1771-KE, -KF) User's Manual, pages 61 to 70
Pages 61 to 70 of 228
The original document is the PDF (9.6 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1771-KE
Page 61
Page 3-27 Installation e RDY - Ready to transmit e ACTY - Active e CPU - CPU (NAK indicator)
The XMTG light comes on when the KE/KF module is current master of the Data Highway and is transmitting a command or reply message.
The RCVG light comes on when the module is receiving a command or reply message from another station on the Data Highway.
If the XMTG and RCVG lights are on at the same time, this indicates that the module is current master of the Data Highway and is polling the other stations to transfer mastership.
The RDY light comes on when the module has a message stored in its transmit buffer and it is waiting to acquire mastership of the Data Highway so it can transmit the message.
~The ACTV light remains on as long as the cable between the COMPUTER (RS-232-C) socket and the interfacing RS-232-C device is properly connected. This light will appear to flicker whenever characters are being transmitted across the RS-232-C link. If this light goes off, check the cable and connectors for possible problems.
The CPU light comes on for about half a second every time the module transmits or receives a DLE NAK protocol sequence (chapter 4). If this light flickers frequently or stays on, the RS- 232-C link might need better isolation or noise immunity.
4 < - - - Transmitting
~«« - - Receiving
~a - _ - Message Ready
4 « - Computer Link Active a ~< - - - RS-232-C Channel Communication Error
Figure 3.13, Diagnostic Indicators
Page 62
Page 63
Chapter
RS-232-C Link Protocols
4.0 General
4.1 Definition of Link Protocol
This chapter describes the communication protocol used on the RS-232-C link to the KE/KF module. If you are connecting a KE/KF module to another Allen-Bradley communication interface module (such as a 1771-KG, 1773-KA, or 1775-KA module), then you need not be concerned with protocol because the modules automatically take care of it. However, if you are connecting a KE/KF module to a computer, then you must program the computer to understand and to issue the proper protocol character sequences, as described in chapters 4 through 6 of this manual.
A link consists of a wire and associated hardware, such as transceivers, UARTs and error checkers. A link protocol carries a message error-free from one end of the link to the other, or it indicates failure with an error code. Internally it delimits messages, detects and signals errors, retries after errors, and controls message flow. It requires that the link hardware send characters from one end of the wire to the other.
The only purpose of a link protocol is to carry a message intact over a link. It has no concern for the content of the message, the message’s function in the operation of higher levels in the system, or the ultimate fate or purpose of the message. Once the message has been reliably carried from one end of the link to the other, the link protocol’s concern for that message is ended.
The RS-232-C port of the KE/KF module can use one of two link protocols, which are:
e Full-duplex protocol (for point-to-point communication) e Half-duplex protocol (for master-slave communication)
In general, full-duplex protocol gives faster data throughput but is harder to implement; half-duplex protocol is easier to implement but gives slower data throughput. Each of these protocols is described independently in sections 4.2 and 4.3, respectively.
NOTE: Some Data Highway documentation might refer to full-duplex and half-duplex protocols as DF1 and polled-mode protocols, respectively.
Page 64
Page 4-2 RS-232-C Link Protocol
4.2 Full-Duplex Protocol
4.2.1 Transmission Codes
The full-duplex conforms closely to ANSI X3.28, combining features of subcategories D1 (data transparency) and F1 (two-way simultaneous transmission with embedded responses).
Full-duplex protocol is used over a point-to-point link that allows two-way simulataneous transmission. It is relatively difficult to implement because it requires a system programmer to use interrupts and multi-tasking techniques. It is intended for high performance applications where it is necessary to get the highest possible throughput from the available medium.
Full-duplex protocol is a character oriented protocol that uses the following ASCII control characters extended to eight bits by adding a zero for bit 7. See ANSI X3.4, CCITT V.3, or ISO 646 for the standard definition of these characters.
Abbreviation Hexadecimal Code STX 02 ETX 03 ENQ 05 ACK 06 DLE 10 NAK 15
The term “code” is defined for use in the following paragraphs as an indivisible sequence of one or more bytes having a specific meaning to the link protocol. “Indivisible” means that the component characters of a code must be sent one after another with no other characters between them. It does not refer to the timing of the characters.
The following codes are used in full-duplex protocol:
Control Codes: DLE STX DLE ETX BCC/CRC DLE ACK DLE NAK DLE ENQ
Data Codes: DATA (single characters having values 00-0F and 11-FF) DLE DLE (to represent the data 10)
Codes can be grouped into two classes: message codes, which are sent from the transmitter to the receiver, and response codes, which are sent from the receiver to the transmitter.
DLE STX is a message code used to indicate the start of a message.
DLE ETX BCC/CRC is a message code used to terminate a message.
Page 65
Page 4-3 RS-232-C Link Protocol
4.2.2 Link-Layer Message Packets
4.2.2.1 Block Check
DATA 00-0F and 11-FF are message codes used to encode the corresponding values in the message itself. DLE DLE is a message code used to encode the occurrance of the value 10 (hex) in the message.
DLE ACK, a response code, signals that a message has been successfully received.
DLE NAK, also a response code, signals that an attempt to transfer a message has failed.
DLE ENQ is a message code. It requests the re-transmission of the last receiver code.
A link-layer message packet starts with a DLE STX, ends with a DLE ETX BCC/CRC, and includes all link-layer data codes in between, Data codes can occur only inside a message packet. Response codes can also occur between a DLE STX and a DLE ETX BCC/CRC, but these response codes are not part of the message packet: they are referred to as embedded responses.
Figure 4.1 shows the format of a link-layer message packet for full-duplex protocol, and the layer at which each portion should be implemented. At the end of each message packet is the one-byte BCC field.
The block check character (BCC) is a means of checking the accuracy of each message packet transmission. It is the 2’s complement of the 8-bit sum (modulo-256 arithmetic sum) of all data bytes between the DLE STX and the DLE ETX BCC/CRC. It does not include any other message packet codes or response codes.
For example, if a message packet contained the data codes 8, 9, 6, 0, 2, 4, and 3, the message packet codes would be (in hex):
10 02 08 09 06 00 02 04 03 10 03 EO DLE STX Data DLE ETX BCC/CRC
The sum of the data bytes in this message packet is 20 hex. The BCC is the 2’s complement of this sum, or EO hex. This is shown in the following binary calculation:
0010 0000 20 hex 11011111 1s compliment +1
11100000 2s compliment (EO hex)
Page 66
Page 4-4 RS-232-C Link Protocols
From Application Layer
From Network Layer
11321
Figure 4.1, Link Packet Format for Full-Duplex Protocol
4.2.3 Two-Way Simultaneous Operation
To transmit the data value 10 hex, you must use the data code DLE DLE. However, only one of these DLE data bytes is included in the BCC sum. For example, to transmit the values 8, 9, 6, 0, 10, 4, and 3 hex, you would use the following message codes:
Represents single data byte value of 10 10 02 08 09 06 00 10 10 04 03 10 03 D2
In this case, the sum of the data bytes is 2E hex because only one DLE text code is included in the BCC. So the BCC is D2 hex.
The BCC algorithm provides a medium level of data security. It cannot detect transposition of bytes during transmission of a packet. It also cannot detect the insertion or deletion of data values of zero within a packet.
On a two-way simultaneous link there are only two physical circuits connecting 4 distinct and independent programs. Referring to the diagram below, transmitter A and receiver B manage the transfer of messages from station A to station B by sending message packets from A to B, and returning responses from B to A. At the same time, transmitter B and receiver A carry out the transfer of messages from station B to station A by sending message packets from B to A, and returning responses from A to B.
Page 67
Page 4-5 RS-232-C Link Protocols
Figure 4.2 shows the four independent data paths involved.
Path 1 Transmitter Receiver
A a B Path 2 _ Path 3
Receiver [™ Transmiter
A ~_ B
Path 4
11556
Figure 4.2, Data Paths for Two-Way Simultaneous Operation
Path 1 carries message codes from A to B; path 2 carries response codes from B to A; path 3 carries message codes from B to A; and path 4 carries response codes from A to B.
To implement all these data paths with only two physical circuits, a software multiplexer combines the message codes with the response codes going in the same direction. At the other end of the link a software separator divides the message codes from the response codes. The message codes are sent to the receiver, and the response codes are sent to the transmitter via internal software. On each physical circuit, response codes from a receiver to a transmitter will be seen intermingled with message codes being sent from a transmitter to a receiver. Figure 4,3 depicts this implementation.
Figure 4.4 shows path 1 with unrelated parts of Figure 4.3 removed.
Paths 2, 3, and 4 could be similarly shown.
The full-duplex protocol is symetrical; that is, anything that can be said about transmitter A, receiver B, and paths 1 and 2 applies equally to transmitter B, receiver A, and paths 3 and 4. There are actually two independent instances of the protocol operating simultaneously. For simplicity the protocol will be defined on the subsystem that carries messages from A to B, with reference to Figure 4.5.
Although the protocols on each subsystem operate independently of each other, there will be a slight interaction as transmission of a message is delayed when a two-character response code is inserted in a stream of message codes. Also, any hardware problem that affects message codes traveling over a hardware circuit will also likely affect response codes on the same circuit.
Page 68
Page 4-6 RS-232-C Link Protocols
M | = Software Multiplexer
S | = Software Separator
Transmitter Receiver A B A A Path 2 Path 1 Path 2 Path 1 ‘ Physical Circuit AB M ~ S L Physical Circuit BA S M L Path 3 Path 4 Path 3 Path 4 i Y Receiver Transmitter A B
11557
Figure 4.3, Software Implementation of Data Paths
Transmitter A
Path 1
Physical Circuit AB
Receiver B
A
Path 1
Y ce?)
11558
Figure 4.4, Path 1, Unrelated Parts of Figure 4.2 removed
Page 69
Page 4-7 RS-232-C Link Protocols
4.2.4 Protocol Environment Definition
4.2.4.1 Message Characteristics
Transmitter Receiver A B A f Path 2 Path 1 Path 2 Path 1 Y Path 1 M Ss Path 2 S - M
11559
Figure 4.5, Message Transmission from A to B
To fully define the environment of the protocol, the transmitter needs to know where to get the message it sends, and the receiver must have a means of disposing of messages. These are implementation dependent functions which shall respectively be called the message source and the message sink.
We assume that the message source supplies one message ata time upon request from the transmitter, and requires notification of the success or failure of the transfer to station B before supplying the next message. When the message source is empty the transmitter waits in an inactive state until a message Is available. Whenever the receiver has received a message successfully it attempts to give it to the message sink. The possibility exits that the message sink will be full. The receiver requires an indication of this.
Figure 4.6 shows this representation of the protocol environment.
Ideally the link protocol should not be at all concerned with the content or form of the message it is transferring. However, full-duplex protocol places the following restrictions on the messages that are submitted to it for transfer:
1. Minimum size of a valid message is 6 bytes, maximum is 250 bytes.
2. Some protocol implementations (point-to-point links to a 1771-KG module, for example) require that the first byte of a message match the station address. The receiver will ignore messages that do not contain the correct address,
Page 70
Page 4-8
RS-232-C Link Protocols
SOURCE
Network Packet
Status
Transmiter A
Path 1
Receiver B
Network Packet
Path 2
Full
SINK
Software ul
LL Software >»
Hardware - >
11560
Figure 4.6, Protocol Environment
3. As part of the duplicate message detection algorithm the receiver checks the second, third, fifth, and sixth bytes of each message. There must be a difference in at least one of these bytes between a message and the previous one for it to be recognized as distinct rather than a retransmission of the previous message. If switch 3 of switch group SW-1 is off, the KE/KF module does not implement duplicate message detection (section 3.1.1).
4.2.4.2 Protocol Definition
Whenever the message source can supply a message and the transmitter is not busy, it sends a message packet on path 1. It then starts a timeout, and waits for a response on path 2.
When a DLE ACK is received, the message has been successfully transferred. After signaling the message source that the message has been sent, the transmitter proceeds with the next message.
If a DLE NAK is received, the message will be retransmitted. The trasmitter restarts the timeout and waits again for a response. This can be repeated several times. There is a user-defined limit to the number of times a message can be retransmitted. If this limit is exceeded, the message source will be signalled of the failure and the transmitter will proceed with the next message.
If the timeout expires before a response is received, the transmitter sends a DLE ENQ on path I to request a retransmission of the last response on path 2. It restarts the timeout and waits for a response. This too can be repeated several times, and there is a user-defined limit on the number of timeouts that are allowed per message. If the enquiry limit is exceeded, the message source will be signalled that the transmission has failed, and the transmitter proceeds to the next message.