Modbus Master response buffer

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
markavo42
Posts: 8
Joined: Sat Nov 24, 2018 11:47 am
Has thanked: 1 time
Been thanked: 1 time

Modbus Master response buffer

Post by markavo42 »

Hi

Can anyone help out and explain please.
I am working with modbus RTU master and flowcode 8 i send a question and get a response the question is correct and crc is correct.
The question expects a response but how do i process this response ?

I guess i should be using GetResponce() i read the explanation and it says:
Collects as much incoming data as possible and stored into the response buffer. The number of bytes received will be stored into location 0 of the response buffer.
Return value indicates validity of incoming CRC. 0 = OK, 1 = CRC fail, 255 = No Data
I receive 0 for OK but how do i access and process the data received meaning how do i access the locations of the response buffer ?
Thank you :D

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Modbus Master response buffer

Post by Benj »

Hello,

Have you looked at the examples on the wiki?
https://www.matrixtsl.com/wiki/index.ph ... 79aa54014a

The GetResponseByte allows you to read a single byte from the slave response. I believe the data might start at byte 2 or 3 but I'll check this for you.

edit. the response looks like this.

0 = Slave Address - Assuming one byte address
1 = Command Byte
2... = Data

0 = Slave Address MSB - Assuming two byte address
1 = Slave Address LSB
2 = Command Byte
3... = Data

The console window can be very useful for looking at the master commands and slave responses. On embedded hardware you could print out the return bytes to a display to help determine what the values are.

markavo42
Posts: 8
Joined: Sat Nov 24, 2018 11:47 am
Has thanked: 1 time
Been thanked: 1 time

Re: Modbus Master response buffer

Post by markavo42 »

Thank you i will take a look :D

Post Reply