01-26-2013 08:40 AM
Any progress made with this problem?
06-22-2014 09:00 AM
it is very easy, please use attach file example code to run, i got the data is correct when conmunication with Cal-3300.
06-23-2014 04:04 AM
OK, but how would you convert that into LabVIEW?
02-11-2015 05:57 PM
Hi
I'm having the same problem as the first post in this thread. I know nothing of Modbus and very little on communication. I tried following the example in the article Introduction to Modbus, Getting started with Modbus in LabVIEW. I've attached the code with the error messages I've received.
Thanks in advance.
02-11-2015 06:01 PM
Also attached is the CAL 3300 Communications Guide and screen shoots from Test and Automation Explorer.
02-11-2015 06:02 PM
Code
02-11-2015 09:54 PM - edited 02-11-2015 09:56 PM
You can always right click on an error code and select "explain error". This should give you a message that makes more sense.
For the visa error:
http://digital.ni.com/public.nsf/allkb/6807113B057FDE4C86256B41008212ED
check to make sure you don't have something else in the system already using the port. If MAX is modifying settings, it could count as that other program. Worst comes to worst you can restart your computer, which should kill any programs using the port.
The second error has this explanation:
"LabVIEW: You configured this serial request as a broadcast. The Modbus slave does not respond to broadcasts. Contact National Instruments for technical support."
You selected a unit ID of 0 which is a broadcast request. Since you are expecting registers back, a broadcast address is not appropriate, hence the error.
Also, you'll want to confirm those port settings you've entered (none/none) with the device. Looks like the device has different options.
02-11-2015 10:23 PM - edited 02-11-2015 10:28 PM
Oh and if you look at the modbus serial spec here (pg 12/44 http://www.modbus.org/docs/Modbus_over_serial_line_V1.pdf) you'll see your device does not meet the standard and will not work out-of-box with the code you showed above. If parity=none is selected, modbus serial devices must have 2 stop bits. Your device uses 1 and therefore does not match the specification. "Option 1" on your device should work fine.
This is documented here (http://zone.ni.com/reference/en-XX/help/370622M-01/lvmve/modbus_create_master_instance/) although ironically I just saw that the documentation is dead wrong on the other two cases. If odd or even is selected, the number of stop bits is 1, per the spec, but the documentation says it is 1.5. I'll file a bug report on that.
You can always force-override any serial setting by using a property node on the port *after* initializing the modbus instance. In this case, between the "New Serial Master" VI and your while loop.
02-11-2015 10:54 PM
I changed the Unit ID of the device to 1. The program made it to the read function until an error was generted. I was trying to figure out the CAL communications guide and all the bites and bytes that needed to be sent back and forth. I think this might be too complicated for my abilities. I was hoping to read and write the Set point and read the temperature value from the controller. It might be easier to figure out a different way of doing this.
02-11-2015 11:03 PM
I changed it to even and recieved error code 56 after the read function. It timed out. Of course I don't know a starting address and I think I read it can only read one register at a time. I changed the number of registers to one but got the same error..