01-03-2019 04:01 PM
Hello,
I have a K-tron K-sampler scale that reports scale Net Weight every 1-second continuously. We are trying to log the Net Weight in LabView. With the supplied scale manufacturer (k-tron) program, the scale cable is RS485>USB to communicate to a laptop for Net Weight logging via Modbus RTU protocol - (19200, Even, Node address = 31, Register 40050/51 IEEE Float NetWeight). Has anyone had experience using the Labview (we have Labview 2017) Modbus API (not DSC module) to communicate via Modbus rtu in order to log data? Thanks
01-03-2019 08:23 PM
Sure. There are a couple Modbus libraries you can use.
I started with http://www.ni.com/example/29756/en/ and still use it. There is a newer version out as well you can get through JKI VI Package Manager called "NI Modbus Library".
For the older library, I don't use the Init Port it comes with. I found it didn't set the stop bits correctly for some of the devices I talk to. I just use the the regular VISA Serial Configure to set the port.
With registers 40050/51, you'll want to use modbus command 3, Read Holding Registers. A quantity of 2, with a starting address of 49. (Drop the 4 from the front of the manuals register address, and subtract 1.) Now you'll have an array with two elements. You will need to typecast that to a single precision float. You may need to swap the elements depending if the most significant word or least significant word comes first.
01-25-2019 08:29 AM
Hi RavensFan,
Thank you very much for the quick reply. I am just wondering if you may know which Modbus library/VI would work best for our scenario. The Modbus communication will send a 'Net Weight' float value every 1-second to LabView.
We are also sending 3 types of data - timestamp, real/float (~80 data points), and binary data (~20 data points) from an OPC server to LabView every 1-second as well. Originally we attempted to use the 'Write to Measurement' express VI but after 5 minutes of logging ~100 data points per second the data-logging slowed from 1-second data points to 2-second logging which is unacceptable. We are going to try 'write to tab delimited' VI first to see if it can log all 100 data-points on a 1-second basis for our needed ~2 hours runtime. If this cannot achieve the 1-second logging then we will try the 'producer-consumer' queue VI.
Thanks,
01-25-2019 10:31 AM
I would use the purple library for a new project.
You'll want function code 3 for Read Holding Registers. Quantity of 2. Start register of 49. (For 40050/40051, you want to drop the 4 and subtract 1)