The text of a manual · part 8 of 23
Bulletin 1771 Communication Controller Module (Cat. Nos. 1771-KE, -KF) User's Manual, pages 71 to 80
Pages 71 to 80 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 71
Figure 4,7, Software Logic for Implementing Transmitter
11322
; Retransmit Same Message
Message Packet
DLE STX Data DLE ETX BCC
Timeout Loop
Received DLE NAK 9
Received DLE ACK
3 * Timeouts for this
Message ?
3* NAKs Received for this
Message ?
Legend
No
= Recovery Procedure
= Ready to Transmit Next Message DLE | ENQ
©) S .
* Default Values Used by the Module
RS-232-C Link Protocols
Page 4-9
Page 72
Page 4-10 RS-232-C Link Protocols
Since there are only two response codes defined, there are no invalid response codes. If the separator returns an invalid response code, the transmitter will ignore it. A more precise and detailed description of the actions of the transmitter appears below in structured English procedures. Figure 4.7 is a flowchart of the software logic for implementing the transmitter.
TRANSMITTER is defined as loop Message=GET-MESSAGE-TO-SEND Status=TRANSFER (Message) SIGNAL-RESULTS (Status) end
TRANSFER (Message) is defined as initialize nak-limit and enq-limit SEND(Message) start timeout loop WAIT for response on path 2 or timeout.
if received DLE ACK then return SUCCESS else if received DLE NAK then begin if nak-limit is exceeded then return FAILURE else begin count NAK re-tries SEND-MESSAGE(message); start timeout end end else if timeout begin if enq-limit is exceeded then return FAILURE else begin count ENQ re-tries; send DLE ENQ on path 1; start timeout end end end loop send DLE STX on path 1 for every byte in the message do begin add the byte to the BCC; send the corresponding data code on path 1 end send DLE ETX BCC on path 1 end
GET-MESSAGE-TO-SEND This is an operating-system-dependent interface routine that waits and allows the rest of the system to run until the message source has supplied a message to be sent.
SIGNAL-RESULTS
This is an implemetation-dependent routine that tells the message source of the results of the attempted message transfer.
Page 73
Page 4-11 RS-232-C Link Protocols
4.2.4.3 Receiver Actions
WAIT This is an operating-system-dependent routine that waits for any of several events to occur while allowing other parts of the system to run.
Since the receiver gets “dirty” input from the physical world, it is more complex, and must be capable of responding to many adverse situations. Some of the things that can conceivably happen are listed here:
1. The message sink can be full, leaving the receiver with nowhere to put a message.
2. A message can contain a parity error.
3. The BCC can be invalid.
4. The DLE STX or DLE ETX BCC may be missing. 5. The message can be too long or too short.
6. A spurious control or data code can occur outside a message.
7. A spurious control code can occur inside a message.
8. The DLE ACK response can be lost, causing the transmitter to send a duplicate copy of a messsage that has already passed to the message sink.
A record of the last reponse sent on path 2 is kept. The value of this response is either ACK or NAK. It is initialized to NAK. When a DLE ENQ is received, the receiver sends the value of the last response from this variable.
A record is kept of several message header bytes. If a message has the same header as the previous message, the message is ACKed but discarded.
The receiver ignores all input from path 1 until a DLE STX ora DLE ENQ is received. If anything other than a DLE STX or DLE ENQ is received on path one, the receiver sets the last response variable to a NAK.
If an ENQ is received, the last response is sent on path 2 and the receiver continues waiting for input.
If a DLE STX is received, the BCC and the message buffer are reset, and the receiver starts building a message.
While building a message, all data codes are stored in the message buffer and added to the BCC. If the buffer overflows, the receiver continues summing the BCC, but the data is discarded. If a parity, overrun, framing, or modem handshaking error is detected, it is recorded. If any control codes other than a DLE ETX BCC is received, the message is aborted and a DLE NAK sent on path 2. When the DLE ETX BCC is received, the error flag, the BCC, the message size, and the address (optionally) are all checked. If any of the tests fail, a DLE NAK is sent on path 2.
Page 74
Page 4-12 RS-232-C Link Protocol
If the message is OK its header is compared to the last message. If it is the same, the message is discarded and a DLE ACK is sent. (Duplicate message detection is not implemented if switch 3 of switch group SW-1 is turned off.)
If the message is different from the last one the state of the message sink is tested. If the message sink is full a DLE NAK is sent; otherwise the message is forwarded to the message sink, the header information is saved for the duplicate message detector, and a DLE ACK is sent.
The procedure for the 1771-KC/KD and 1771-KG(Rev. C) modules is different. First, they check the message sink state. If the sink is full, the response is recorded but not sent. The receiver waits for a DLE ENQ on path 1. If any other code is received, the response is changed from ACK to NAK and the receiver continues waiting for a DLE ENQ. If a DLE ENQ is received, the sink status is checked. If it is still full, the receiver continues waiting. If it is not full, the last response is sent and the receiver then accepts new messages. This variation is not documented in the structured English section below.
The receiver for the KE/KF module is listed below in structured English. Figure 4.8 is a flowchart of the software logic for implementing the receiver.
Page 75
Page 4-13 RS-232-C Link Protocols
( RCVE )
LAST =NAK
No
A awe
DLE ENQ ?
Receive
Message )
BCC/CRC OK ?
LAST = NAK
Yes
LAST = ACK
Send DLE LAST
11699
Figure 4,8, Receiver for Full-Duplex Protocol
Page 76
Page 4-14 RS-232-C Link Protocols
RECEIVER is defined as variables LAST-HEADER is 4 bytes copied out of the last good message RESPONSE is the value of the last ACK or NAK sent BCC is an 8-bit block check accumulator
LAST-HEADER = invalid LAST RESPONSE = NAK loop reset parity error flag GET-CODE if DLE STX then begin BCC=0 GET-CODE while it is a data code begin if buffer is not overflowed put data in buffer GET-CODE end if the control code is not a DLE EXT then send DLE NAK else if error flag is set then send DLE NAK else if BCC is not zero then send DLE NAK else if message is too small then send DLE NAK else if message is too large then send DLE NAK else if header is same as last message send a DLE ACK else if message sink is full send DLE NAK else begin send message to message sink send a DLE ACK save last header end end else if DLE ENQ then send LAST-RESPONSE else LAST-RESPONSE = NAK end
GET-CODE is defined as loop variable GET-CHAR if char is not a DLE begin add char to BCC return the char and data flag end else begin GET-CHAR if char is a DLE begin add char to BCC return a DLE and a data flag end else if char is an ACK or NAK send it to the transmitter else if char is an ETX begin GET-CHAR add char to BCC return ETX with a control flag end else return character with a control flag end end end
Page 77
Page 4-15 RS-232-C Link Protocol
GET-CHAR is defined as an implementation dependent function that returns one byte of data from the link interface hardware.
4.2.5 The following figures show some events that can occur on the Full-Duplex Protocol Diagrams _ various interfaces. Time is represented as increasing from the top of the figure to the bottom.
SOURCE XMTR LINK RCVR SINK
(Data), - », DLE STX (Data) DLEEXTBCC, - >
Not Full
(Data), - - - - -
+ DLE ACK, a - @# - - -OK 11561 Figure 4.9, Normal Message Transfer SOURCE XMTR LINK RCVR SINK
(Data), - _ - - - iH - - DLE STX (Noise) DLEEXTBCC, - »
~t DLE NAK, - - DLESTX (Data) DLEEXTBCC ~ - e
~t Not Full
(Data) >
« DLE ACK i, $ - - - - OK Note that the message sent for the second poll is the same as the first, since the first transmission was not ACKed.
11562
Figure 4.10, Message Transfer with NAK
Page 78
Page 4-16 RS-232-C Link Protocol
SOURCE XMTR LINK RCVR SINK
(Data) - - - - - >, ODLESTX(Data)DLEEXTBCC - - ~>, - Not Full
(Data), - - - - _-
<« - _ - - _____- - - - DL (Noise) CK
(Timeout) DLE ENQ > al DLE ACK i - _ - - OK 11563 Figure 4.11, Message Transfer with Timeout & ENQ SOURCE XMTR LINK RCVR SINK
(Data), - - - - _, DLESTX(Data)DLEEXTBCC - - »
<a - - - - - Not Full
(Data) >, - - DL (Noise) CK (Data)
v
(Timeout)
DLE ENQ aa
DLE NAK
4, DLESTX (Data) DLEEXTBCC, - > (Message Discarded)
DLE ACK
4
~t OK
Retransmission occurs when noise hits both sides of the line. This type of noise destroys the DLE ACK while also producing invalid characters at the receiver. The result is that the receiver changes its last response to
NAK and the transmitter retransmits the original message. Note that this is detected as a duplicate message if switch 1 of switch group SW-1 is on. ; 11564
Figure 4.12, Message Transfer with Retransmission
Page 79
Page 4-17 RS-232-C Link Protocol
SOURCE XMTR
LINK RCVR SINK, - (Data), - - - A
DLE STX (Data) DLEEXTBCC 1, >, - - - - - - - _DLE NAK
DLE STX (Data) DLEETXBCC, »
Full
Full
A
DLE ACK
DLE STX (Data) DLEEXTBCC - - - »
= - _ - - - - - _ DLE ACK, - - - - - Not Full
(Data), - - - _>
11565
Figure 4.13, Message Transfer with Message Sink Full
4.2.6 Examples
If a line monitor were connected to the wires between station A and B, and only the A to B subsystem were active, the following would be observed:
Normal message
Path 1: DLE STX...DLE ETX BCCDLE STX....DLE ETX BCC Path 2: DLE ACK DLE ACK
Message with parity or BCC error and recovery
Path 1: DLE STX..XXX..DLE ETX BCC DLE STX....DLE ETX BCC Path 2: DLE NAK DLE ACK
Message with ETX destroyed
Path 1: DLE STX.....XXXX [timeout] DLE ENQ DLE STX....DLE ETX BCC Path 2: DLE NAK DLE ACK
Page 80
Page 4-18 RS-232-C Link Protocol
4.2.7 Embedded Response Option
4.3 Half-Duplex Protocol
Good message but ACK destroyed
Path 1: DLE STX...DLE ETX BCC|timeout] DLE ENQ DLE STX ... ete. Path 2: DLKXXCK DLE ACK
Messages being sent in both directions
Path 1: DLE STX...DLE ETX BCC DLE STX....DLE ETX BCC DLE STX
Path 2: DLE ACK DLE ACK
Path 3: DLE STX... ...JDLE ETX BCC DLE STX Path 4: DLE ACK
Combined, Circuit AB: DLE STX...DLE ETX BCC DLE STX....DLE ETX BCC DLE ACK DLE STX Circuit BA: DLE STX...DLE,ACK....DLE ETX
BCC A DLE,ACK DLE STX embedded response ACK on AB delayed slightly because ETX BCC are indivisible
To allow simplification of the design of the receiver in some cases, you can disable transmission of embedde responses by turning off communication option switch 2 of switch group SW- 1. If this switch if off, the KE/KF module’s multiplexer will not allow response codes to be sent within a message. Instead, it will delay response codes until after it receives the next DLE ETX BCC sequence. |
Half-duplex protocol is an alternate link protocol to full-duplex protocol. You can select this protocol by turning on communication option switch 1 of switch assembly SW-1. Half-duplex protocol is based on full-duplex but extends or redefines several features.
Half-duplex protocol is a multidrop protocol for one master and one or more slaves. Modems must be used (unless there is only one slave). The units have slave mode capability only; the master function must currently be provided by a user-programmed intelligent device.
Half-duplex protocol provides a lower effective utilization of resources than full-duplex, but it is much easier to implement. Its use is indicated by the following:
e Multiple stations and a single computer are connected ina multidrop configuration using multi-drop modems.
e Half-duplex modems are being used.
¢ It is desirable to sacrifice throughput in exchange for ease of implementation.