I'm a beginner and I'm trying to acquire data from a microcontroller with Modbus serial protocol in order to create an interface with LabVIEW. I'm using a Prolific Technology USB-RS232 converter and Windows 7 as OS. I can't read data from the micro. I know that read only varibles are in registers from 100hex and 1FFhex and read/write variables are from 200hex and 2FFhex. How does the memory of micro need to be used? How do I define holding registers and input registers?

Thanks in advance for any advice.


  • \$\begingroup\$ It's not clear whether you are asking about implementing Modbus over serial in a micro, or how to talk to a Modbus device from Labview running on a PC. \$\endgroup\$ Jan 29, 2016 at 14:39

2 Answers 2


Here are a few basic Modbus Commands you need to know:

0x01 - Read Coil Status

0x02 - Read Input Registers

0x03 - Read Holding Registers

Holding registers are READ ONLY registers. They typically hold values that the microcontroller measured or calculated. Input registers, in my experience, are Read/Write and are used to give parameters to the controller.

You should download a Modbus Master program from the internet, there are hundreds. The program will use the 232 port to send the modbus commands to the controller and wait for a response.

A typical Modbus Master message looks like this:

Read Holding Registers 100-105:

Device Address  Command     1st Reg     Number of Registers     Checksum
  100            0x03        0x64              6                  CRC
                                        (our starting 
                                         register + 5)

There are a number of questions you need to answer before connecting to a Modbus interface:

1) What is the physical layer?

Modbus can be transported over a RS-232, RS-485, or Ethernet. Based on your question I'm going to assume you've already determined that it is RS-232.

2) What are the parameters of the RS-232 connection?

You will need to know baud rate, data bits, stop bits, parity, and whether or not there is any flow control being used.

Typically baud rate varies from controller to controller, but the remaining parameters will almost certainly be 8 data bits, 1 stop bit, no parity, and no flow control.

3) What are the parameters of the Modbus connection?

In order to communicate with a Modbus device you must first know what format of Modbus is being used this will be ASCII or RTU. ASCII you could in theory use a terminal program and manually type in the requests and receive responses. RTU you will need to write software to send command/response bytes between LabView and the micro controller. For either format you will need the drop number of the device you are communicating with since sometimes multiple Modbus devices will exist on a single network.

4) You will need software that can form and send Modbus request packets and receive and parse the Modbus response packets.

For more details on what these packets look like refer to the Modbus specification under technical information at Modbus.org. If you want to test that the Modbus communication is working I'd recommend a program such as ModScan. Once you've verified that the Modbus communication between the PC and the device is working you can take on the next step of interfacing LabView with Modbus.


Not the answer you're looking for? Browse other questions tagged or ask your own question.