Rockwell Automation 1775-KA PLC-3 Communication Adapter Module User Manual User Manual

Page 120

Advertising
background image

Full-Duplex Protocol

Chapter 10

10Ć16

Table 10.B

Receiver for Full-Duplex Protocol

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 ETX 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

Advertising