Showing results for 
Search instead for 
Did you mean: 

Need help with read/write to MODBUS RTU registers in Labview 8.0

Hi Wiebe..

Thanks for your answer to me.. Yes, it will be puzzle to figure it out, but I'll try.. The difficult part will be to make the UI work, cause I need to update every subvi(rooms) when changes appear, and also that I need to open each subvi to adjust paramters like temperature, night set back, week days etc.. 

But I will try, and thanks again for your answer.. 

Very best regards Benjii

0 Kudos
Message 21 of 31
Perhaps this will only confuse you, but I'll say it anyway...

If you have multiple VI's that need to be updated, you can put the user event in all of them. Lets say you have one VI that registers for the user even. If you make that VI a template, you can open it as often as you like (you can also save it with different names, but you'll have to correct errors for each copy). And each copy will register for the user events. The beauty of user events is that all the registered vi's get the event. This never goes wrong, it's very reliable.

Also, if the DAQ loop knows which room is updated, you can send that information with the user event. We usually make one user event for each type (mostly UI and DAQ), and each user event has an type def enum and a variant in a cluster. So if a room updates, the DAQ sends the enum "room updated", with the room number in the variant. When we receive the event, we'll use a case to handle the enum, and convert the variant to the number. This way, VI's that don't need DAQ events, will not get them, and VI's can respond to each UI enum the way they want.

Check out this code LVUG 2006 Example Code . We also have a presentation about it, but it's in Dutch : LVUG 2006 10 05.pdf . It's about sending user events to VI's in sub panels, but the user event part can be applied in any situation. Especially the event buffer is very useful, and very tricky to find out.


0 Kudos
Message 22 of 31

Hi Again Wiebe...

I just want to thank you for your information..  The link you sent me was very useful, and when I study them I understand more and more...

Very best regards.. Benjii..

0 Kudos
Message 23 of 31

Dear Paul Falkenstein,


I have downloaded Modbus CRC-16 VI and trying to calculate the CRC which is to be given to a PID controller. But I am not getting a correct CRC value for my String which has hex codes. Kindly hepl me please...


The String is 010400060001 and the CRC should be D1CB. But I am getting only B8 as CRC from the Modbus CRC-16.


Another String is 0110B800030601F40000FFFF and the CRC should be D1C9. Kindly help me to get the correct CRC. I dont know what the mistake i am doing.


Thanks in advance


Dr. Jeyadheepan. K

0 Kudos
Message 24 of 31

When I take your string, put it in a string control formatted for Hex display, and run it through the Modbus CRC-16.  I get exactly what you expect, D1CB.


Are you sure you are entering the correct string?  Are you sure you have a binary string, or is it a string of hexadecimal characters?


Rather than posting in a 6 1/2 year old thread, please start a new thread.



0 Kudos
Message 25 of 31




Hi guys,,,,


I'm trying to communicate with a Freescale Microprocessor MKL15Z32VFM4.


The protocol is using the TTL-UART port of the processor and MODBUS RTU, 19200, 8 data bits, 1 startBit, 1 stop bit, parity Even.


I have some string instructions to processor as "STATUS" or "DCLEVEL", and CRC bytes, etc. and of course I have to read the return, I'm using the to get the CRC bytes.


If I send the "STATUS" (+ CRC of course) command to Microprocessor, it's suppose to send me back a U16 data (I thing from address 0x138A)


Do any body makes this one before on Labview? How Can I send the "STATUS + CRC" to microprocessor Thru serial port (I have to use a Serial to TTL-UART adapter)


I review the most of the MODBUS RTU post (and still reviewing), but I can't find anything than works.


Thank you!

0 Kudos
Message 26 of 31

Your commands don't sound anything like Modbus RTU.  You should start a new message therad.

0 Kudos
Message 27 of 31


That is the specification from my Customer



"The xxxx communicates using MODBUS RTU Serial mode. The device operates at 19.2kBd, 8 data bits, 1 start bit, 1 stop bit and even parity. All MODBUS requests require a two (2) byte Cyclical Redundancy Check (CRC) be appended to the message and a two (2) byte CRC will be appended to the response. Note that each command must be sent in individual byte packets"



and they enlist the commands, one is "STATUS"

0 Kudos
Message 28 of 31

"STATUS" is not a modbus command.  Perhaps there is a modbus register that can tell you the status of the device.  But you'll only know that if they give you a full listing of the registers, addresses vs. meaning.


Start a new thread.

0 Kudos
Message 29 of 31


well they put the response too, :







Address (Hex)


MCU Type

Upper limit

Lower limit

Hex String












Maybe I just need to read the address 5002? how can I do that? I have connected just one microprocessor..



0 Kudos
Message 30 of 31