03-31-2009 04:11 PM - edited 03-31-2009 04:13 PM
Trying to communicate with a master device using the Modbus library 1.2 and LV 8.5. We've matched all the serial parameters I think (9600, 8 data, parity None, 2 stop, no flow). But when I run the Serial Slave example, we see nothing in the holding registers. The master is using function 16 (write mult. registers). Should Read All Holding Registers work then? Master is writing to register address 0x01 if it matters.
We've confirmed correct data is being sent and that the serial port (PXI-8430) is working. I changed the serial settings in MAX as well, but are the advanced ones there critical? Anything else to check? Thanks.
04-01-2009 04:19 PM
Hey Beck,
For the serial slave, I'm assuming that you're using one of the serial ports on the 8430? Is the Master device another one of the 8430's ports, or is it some other device? You might want to also verify that you're using the correct cable for your devices (some require Null Modem, some require Straight-Through). Also, what application is the Master device running in? Is it the MB Serial Master example, or is it something else? Thanks
04-03-2009 08:55 AM
04-06-2009 05:53 PM
Hey Beck,
The LabVIEW program that you are using is intended to be run with the MB Serial Example Master program. What this might mean is that the Slave program is expecting the Master to put data in one particular location, but your master is putting data in a different location and thus you aren't seeing anything in the registers on the front panel because nothing has been written to them. What I would recommend you do is open up the MB Serial Example Master program, and make sure that your Master device is writing to the same locations that the example program is. Also, are you receiving any errors with this program, or are you just not seeing the data in the registers?
04-07-2009 01:23 PM
No, not seeing any errors, just no data. I looked at the Master Example and it writes to registers 0-3. Our master writes 8 registers starting at address 1. But in both cases shouldn't Read All Holding registers in the slave program work? Other than that, we use slave address 0x10 which the master is set to.
I could probe the Serial Recieve VI to see what's being read but it's called by re-entrant reference so I can't seem to watch it. The Basic Serial Write and Read VI is able to read data at the same port.
Also, I read with no parity, you have to use 2 stop bits. We only use 1; is this a problem?
04-08-2009 04:48 PM
Hey Beck,
Yes, you are correct in saying that Read All Holding registers should return what's been written to that space in memory. It definitely could be an issue with the different number of stop bits used between devices, so I would suggest that you match all serial parameters between the two devices. You should be able to either change the COM (slave) settings to match the master, or the master's settings to match the COM. Let me know how changing this works out
04-14-2009 02:57 PM
04-15-2009 02:03 AM
Hi Beck,
I think it is best to be sure you communication is OK before looking at the MB protocol en VI's.
One remark; the number of stopbits is not important. Once you got things working you will see that it doesn't matter what number of stopbits you use.
You ModBus slave device should support the basic MB commands. One of them is the loopback command. Now take the 'Basic Serial Write and Read' example VI.
Put both string indicators in HEX display, set your serial parameters.
Fill the send data control with 0108 0000 AA55 5E94 This is the data for a loopback test. If the communication with your device is OK you should see the same data string coming back.
When this is OK we can start the next test. Getting one or more registers. Give me the address of a register and I get back with the data to send.
But first the loopback test.
04-15-2009 04:18 PM - edited 04-15-2009 04:19 PM
04-16-2009 02:06 AM
OK, you are sure that data is send by the master.
I looked at the MB library but never used it for my MB devices. Creating a few dedicated VI's was easier then using the lib.
If the LV program should act as a slave you should be able to see if data is coming in with the serial example. Did you try this? Can you show the data you receive with the serial example.