04-16-2010 09:31 AM
I am having a problem communicating with a Modbus Server in a multiple client, serial network. I don't have the DSC module installed, so I'm using the modbus library. When I run the vi without any other clients the program runs fine, but it appears that when the network is 'flooded' with Modbus data, the Visa read function is not fast enough to recognize the slave address. This results in a very slow response, or even a complete loss of data flow.
Any help would be appreciated!
Chris
L.V. 8.6.1
OS Win XP
04-16-2010 10:15 AM
04-16-2010 02:50 PM
are you saying that you have multiple master devices on the serial network. or multiple slave devices and one master device?? What type of serial network?? rs232, rs485 multidrop, two wire or four wire rs485?? Are you polling all of the devices for info or using a broadcast mode where data is continuously transmitted?? How many devices and what baud rate are you using?? RTU mode or ASCII mode?? RTU mode will use half the characters. The VISA read function needs to wait for complete modbus data packets, either by calculating ahead of time how many bytes to receive, or waiting for a termination character.
The slave address should be contained in a full modbus data packet. I would recommend recalculating the modbus command checksum inside your labview code and comparing it to the checksum inside the data packet. This way you guarantee data integrity.
04-26-2010 06:14 AM
Thank you for your reply, I was out of the office for a while...
Unfortunately the system's setup doesn't allow me to change to ethernet. I do agree Modbus IP is a lot easier to work with.
04-26-2010 07:29 AM
The system consists of 17 slaves and a single master. My computer is one of those slaves. The network type is 2 wire RS485, RTU mode. I'm trying to use the Modbus Slave VI that comes with the Modbus Library. I have used it before, but only as a master. It seems the "MB Serial Recieve.vi" in the Deamon cannot detect the correct slave address, slowing the process.
When I ignore the slave address, it seems to work just fine, a bit slow perhaps. Still this is not the solution...
Perhaps anyone else ran into a simulair problem?
04-26-2010 09:41 AM
The slave daemon seems to be able to set the slave address. But the Serial slave example has a slave address of 1 hardcoded in it and sets the control value for the slave address in the daemon to that value of 1. (Look in frame 4 of the stacked sequence structure in the serial slave example.)
Not a real good example since it hard codes that. You may want to change that constant to match yours, or even turn the constant into a control.
04-26-2010 09:52 AM
04-27-2010 05:52 AM
Thank you for your posts!
Perhaps I'm using some other library, but I can't seem to find this hardcoded 1...
This is the one I am using: http://sine.ni.com/devzone/cda/epd/p/id/4756
The slave address is used in MB serial receive.vi, in frame 'no error', '0', '0', 'default'.
04-28-2010 05:54 AM
As Ravens Fans wrote, check MB Serial Example Slave.vi, frame 4, where a constant value 1 is assigned to the Slave Address control of the daemon vi.
You can assign another value, or better load the address from an ini file.
05-12-2010 05:55 AM