Rockwell Automation 1770, D17706.5.16 Ref Mnl DF1 Protocol Command User Manual
Page 41

3–4
Using Half-duplex Protocols to Send and Receive Messages
Publication 1770Ć6.5.16 - October 1996
The following program describes the actions of the transceiver in
detail:
TRANSCEIVER is defined
variables
LAST-HEADER is 4 bytes copied out of the last good message
BCC is an 8-bit block check accumulator
LAST-HEADER = invalid
loop
reset parity error flag
GET-CODE
if it’s a DLE SOH then
begin
GET-CODE
if it’s a data code and it matches the station number or it
is 255 (the broadcast address) then
begin
BCC = the data code
GET-CODE
if it’s a DLE STX then
begin
RESPONSE = GETMESSAGE
if RESPONSE is ACK then
begin
if message header is different from
last and sink is not full
begin
save new HEADER
try to send message to sink
end
if this is not a broadcast message
and sink was not full then
begin
turn on RTS
wait for CTS
send DLE ACK
turn off RTS
end
end
end
end
end
else if it’s a DLE ENQ then
begin
GET-CODE (the station number)
GET-CHAR (the BCC)
check the station number and the BCC, and if they’re OK then
begin
if there is a message left over from the last time and
the transmit counter is exceeded then
throw the message away and send an error code to the
message source
if there is no message then
try to get one from the message source
turn on RTS
wait for CTS
if there is still no message then send a DLE EOT
else SEND the message
turn off RTS
end
end
else if it’s a DLE ACK then
send a success code to the message source and discard the
message
else if it’s a DLE NAK then
while the message source can supply a message
begin
get a message from the message source
discard the message
send an error code to the message source
end
end