17 COMMUNICATING WITH ASCII CODE (ASCII-BIN CONVERSION)
17.5 ASCII-BIN Conversion for Data Communicated with Bidirectional Protocol
359
17
17.5 ASCII-BIN Conversion for Data Communicated
with Bidirectional Protocol
This section explains the ASCII-BIN conversion of data to be communicated using the bidirectional protocol.
Transmitted/received data range for ASCII-BIN conversion
The range of data to be sent/received to which ASCII-BIN conversion is performed is as shown below:
C24 performs the following processing when sending or receiving data.
■At the time of data reception
Processing flow when a message is received during data reception
• C24 converts a received data length (4-digit ASCII code data (hexadecimal)) to 2-byte binary code data and stores it in the
receive data quantity storage area.
• C24 converts each two characters of a received data portion (2-digit ASCII code data (hexadecimal)) to 1-byte binary code
data and stores it in the receive data storage area.
• C24 calculates a sum check code using the received data length and data portion prior to ASCII-BIN conversion, then
checks the received head of the sum-check code using the code as a lower byte.
Processing flow when a response message is received
• C24 converts the first 2 digits of a received error code (4-digit ASCII code data (hexadecimal)) to 2-byte binary code data as
the lower byte, and stores it in the transmission result storage area. (When '1234' is received, it is converted to 3412H and
stored.)
■At the time of data transmission
Processing flow when a message is transmitted during data transmission
• C24 converts a data length (send data quantity) to 4-digit ASCII code data (hexadecimal), and sends it beginning with the
lowest byte (L).
• C24 converts a data portion (send data) for one address to 4-digit ASCII code data (hexadecimal), and sends it beginning
with the lowest byte (L).
• C24 calculates a sum check code using the data length and data section after ASCII-BIN conversion, and adds it to the
transmission message.
Processing flow when a response message is transmitted
• C24 converts an error code for a detected error to 4-digit ASCII code data (hexadecimal), then sends it beginning with the
lowest byte (L).
(For 3412H, it is converted to '3412' and sent beginning with '12'.)
N
A
K
A
C
K
E
N
Q
Applicable data range at transmission/reception
(Arbitrary data)
Sum check
code
Message at data
transmission/reception
Data
length
Data
section
Applicable data range at transmission/reception
Response message
Error code