Modbus RTU Framing


Thread Starter


I am trying to develop a c++ program for acting as a Modbus master (for data acquisition from power meter which works on Modbus RTU protocol) for my project work. The Modbus RTU protocol says that the query to slave must be framed i.e. succeeded and preceeded by 3 and half character elapse. I don't understand what it actually means, and how can it be achieved through c++ program. Please help me out.

Assuming you are running on a MS Windows box it is not really possible, without creating a low level driver, but no worry, you do not need to handle the framing.

This is a master slave connection. For transmitting, send your query and wait for the response.

For receiving you can determine the response length by the query you transmitted. Continue to receive characters until you reach the predetermined count and then handle the message.


Hello Mark,

Thanks for replying. I have developed a c++ program for carrying out data acquisition using Modbus protocol. I am trying to send and receive data from COM PORT 1 using outportb and inportb respectively in combination with userport.exe (which enables port access). This is meant to work on MS windows XP. I have the complete data which is to be sent along with the 2 byte crc. Do you think it will work out?

Reply to me at
prashob.n @ rediffmail. com
Many programs exist, including ours, which communicate via a serial connection to devices using MODBUS RTU protocol.

So, I know it is possible.

If the question is will your program work, I do not know.

Good luck,