Marco (Customer) asked a question.

How to read communication data?

I am going to use MODBUS to communicate with a PC.

The PC will send ["byte length" ]["command"]["information"]["CheckCode"]

Garry taught me that I can copy the array to some where to begin with.

Now my question is that how can I program the following in PLC

 

How can I decompose the message? How can I do something below?

 

Copy MODBUS_data_array to local_array

byte_length = length(local_array)

While temp_byte_length<byte_length

temp_byte_length = temp_byte_length + 1

if local_array(temp_byte_length) is command

switch (The_command)

GoTo SubFunction1(local_array(temp_byte_length+1:end))