3E-Frame(ASCII & Binary) With FX5U & Q-PLC
CPU module device data can be read and written using 3E frames from external devices.
So lets start with the data format of 3E Frame. Request data and Response Data.
Request message consists of two main part.
First Header and second Application Data.
Header is for TCP/IP and UDP/IP and its not added by user most times, its added automatically.
Application Data is further divided into several parts.
Subheader indicates whether the message is a Request message or Response message.
There are only two Subheader one is “5000” which is a request code for plc.
Second is “D000” which is response code.
RDMIO consume 4 Byte when using ASCII, and 2 Byte When using Binary Code.
When writing request message use RDM I/O No. as “03FF”(ASCII)
When writing request message use RDM I/O No. as “FF03”(Binary)
RD Length will consume 4 Byte in ASCII and 2 Byte in Binary .
Reserve is always “0000”.
Count the number of byte from reserve to end of request data. Convert it to Hex. When the request data length is 24 (18H) bytes, use “0018”
Command will consume 4 bytes in ASCII and 2 Byte in Binary, Subcommand will consume 4 byte in ASCII and 2 Byte in Binary.
There are many different Command used to define how and what function is to be performed, Like “0401” for Batch Read, “1401” for Batch Write.
There are many other different command, but these are two basic.
There are many Subcommand, Like “0001” command reads data from a bit device or word device in units of 1 bit. Other “0000” This command reads data from bit devices in units of 16 bits. This command reads data from word devices in units of 1 word.
Device code will define device type to be read or write,
Like for Data register code is “D*” in ASCII and “A8” in Binary Code
For Internal relay or M-Bit code is “M*” in ASCII and “90” in Binary Code
For Inputs code is “X*” in ASCII and “9C” in Binary Code
For output code is “Y*” in ASCII and “9D” in Binary Code
Device Code will consume 2 bytes in ASCII and 1 Byte in Binary.
Specify the head number of target device of reading.
Like if we want to read D2 as starting address, than device code is “D*” in ASCII and “A8” in Binary, head device number will be “000002”
Device Code will consume 6 bytes in ASCII and 3 Bytes in Binary.
Specify the number of target device points of reading.
Like if we want to read D2, D3 & D4 and D2 as starting address, than device code is “D*” head device number will be “000002” and Number of device will be “0003” in ASCII, In case of Binary Only “D*” will convert to “A8”.
Device Code will consume 4 bytes in ASCII and 2 Bytes in Binary.
Example of Request Data for ASCII(Read)
Previously we discussed all the parts of request message, Now lets make a full code here to read 10 data word from D0 to D9.
As we have all the data required to make a request message, Lets combine the data as per shown in the request message diagram.
Header: Not Required
Sub header: “5000”
RDN No: “00”
RDS No: “FF”
RDMIO No:”03FF”
RDMS No: “00”
RD Length: “0018”
Reserve: “0000”
Command: “0401”
Sub Cmd:”0000”
Device Code: “D*”
Device No: “000000”
No of Devices:”000A”
“500000FF03FF000018000004010000D*000000000A”
Example of Request Data for Binary Code (Read)
Previously we discussed all the parts of request message, Now lets make a full code here to read 10 data word from D0 to D9.
As we have all the data required to make a request message, Lets combine the data as per shown in the request message diagram.
Header: Not Required
Sub header: “5000”
RDN No: “00”
RDS No: “FF”
RDMIO No:”FF03”
RDMS No: “00”
RD Length: “000C”
Reserve: “0000”
Command: “0401”
Sub Cmd:”0000”
Device Code: “A8”
Device No: “000000”
No of Devices:”000A”
“500000FFFF0300000C000004010000A8000000000A”
Example of Request Data for Binary Code (Read)
“500000FFFF0300000C000004010000A8000000000A”
For the above code, we used D31 to D41 to make a request message.
Example of Request Data for ASCII(Write)
Previously we discussed all the parts of request message, Now lets make a full code here to write 2 data word from D0 to D1.
As we have all the data required to make a request message, Lets combine the data as per shown in the request message diagram.
Header: Not Required
Sub header: “5000”
RDN No: “00”
RDS No: “FF”
RDMIO No:”03FF”
RDMS No: “00”
RD Length: “001E”
Reserve: “0000”
Command: “1401”
Sub Cmd:”0000”
Device Code: “D*”
Device No: “000000”
No of Devices:”0002”
D0: AAAA
D1: BBBB
“500000FF03FF000018000014010000D*0000000002AAAABBBB”
Example of Request Data for Binary Code (Write)
Previously we discussed all the parts of request message, Now lets make a full code here to write 2 data word from D0 & D1.
As we have all the data required to make a request message, Lets combine the data as per shown in the request message diagram.
Header: Not Required
Sub header: “5000”
RDN No: “00”
RDS No: “FF”
RDMIO No:”FF03”
RDMS No: “00”
RD Length: “0010”
Reserve: “0000”
Command: “1401”
Sub Cmd:”0000”
Device Code: “A8”
Device No: “000000”
No of Devices:”0002”
D0: “AAAA”
D1: “BBBB”
“500000FFFF03000010000014010000A80000000002AAAABBBB”
Well explained.
ReplyDelete