364
17 COMMUNICATING WITH ASCII CODE (ASCII-BIN CONVERSION)
17.6 Data Communication Using Bidirectional Protocol
Example of data transmission
Data transmission example (ASCII-BIN conversion is enabled)
The following shows an example of data transmission with ASCII-BIN conversion used.
For data designated by the CPU module, data for one word is converted to 4-byte data ('0' to '9' and 'A' to 'F') and transmitted.
■Program example
For information on the module FB to be used, refer to the following manual.
MELSEC iQ-R Serial Communication Module Function Block Reference
Category Label name Description Device
Module label C24_1 Target module
Label to be defined Define the global label as shown below.
X50
M0
M1
BIDOUT
ON
ON
6DH
L
H
04H
1
31H
2
32H
3
33H 34H 35H05H
4
D
43H
C
44H30H 41H42H
LH
0
40
0
34H 30H 30H
5BA 0
30H
0
30H45H 46H
FE0
44H
D
30H 41H
A
06H
E
N
Q
A
C
K
D3
00H , 04H
D10
D11
D12
D13
34H , 12H
BCH , 5AH
F0H , DEH
0AH , 0DH
00H , 04H
34H , 12H
BCH , 5AH
F0H , DEH
0AH , 0DH
Target
device
Sum
check
code
Data length Data area
(0004)
C24
Transmission
command
Data length (Number of data transmitted): Excluding additional code
CPU module
Word units
Number of bytes after ASCII-BIN conversion: (8)/2=4
Byte units
Completion
device
Number of bytes after ASCII-BIN conversion: (8)
Abnormal
completion
Status display
device
at completion
The following diagram is for word unit
Normal
completion
1 scan
Un\G1024
Un\G1025
Transmission data
Un\G1026
Un\G1027
Un\G1028
Transmission
data
Program
device memory
Buffer
memory