LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus

Hey guys,

I'm trying to connect an RS485 serial oven controller to labview using modbus TCP.  I have the RS485 to ethernet converter already hooked up and the LEDs on the converter tell me that data is being sent and recieved when I use the online interface but when I use labview I always get the Modbus exception error 1 (6001).  I know this means that I have a faulty function code but I'm not sure how that is possible because I am using the NI Modbus library that uses preset funciton codes depending on what you want to do.  I'm stuck.  Please help.

 

0 Kudos
Message 1 of 7
(4,104 Views)

You lost me on your statement about the RS-485 to ethernet converter.

 

The oven uses an RS-485 serial port interface?  If so, why are you using the TCP/IP versions of the modbus library.  You should be using the Modbus RTU serial port versions.

 

Does your PC have an RS-485 serial port?

 

Or are you using a remote serial port device that allows you to communicate over ethernet, but provides an RS-485 serial port to connect to your oven?

If so, then that device should have come with a driver that puts a virtual serial port on your PC.  You would then use the Modbus RTU version of the library and connect to that virtual serial port.

0 Kudos
Message 2 of 7
(4,101 Views)

Yes the oven uses an RS-485 serial interface and I've already gotten it to work with labview using the Modbus RTU VIs but there are other ovens that we have that use TCP so our client wants them all to be connected using ethernet.  We have a MB-GATEWAY made by Automationdirect to communicate with ethernet.  I havn't seen any drivers for making a virtual serial port and if it did how would I communicate with it if the Modbus RTU VIs don't have an input for the IP Address?

0 Kudos
Message 3 of 7
(4,098 Views)

You don't want to make a virtual serial port.

 

A virtual serial port is a way that the manufacturer of a remote, ethernet based serial port makes it work so that the serial port at the end of the ethernet line works the same way as a real hardware serial port would work if it is installed in a PC.

 

If you are going to have different ovens, some serial based, some TCP/IP based, then I wouldn't recommend trying to force one method (RTU vs. TCP/IP) to work for all of these different devices.

 

You could abstract out this layer of differences.  Have a VI that wraps up both the RTU version and the TCP/IP version.  Your wrapper VI will just call whichever version is more appropriate for the particular oven you are trying to talk to.

 

An Action Engine will allow you to store settings such as which version you want to use and the VISA com port or the TCP/IP connection reference.

Message 4 of 7
(4,091 Views)

ModbusTCP to Serial gateways are a fine way for connecting legacy serial stuff to a single IP address. Typically, the modbus function block in a PLC or labview for instance, will allow one to set a 'Unit ID' which would correspond to the node / drop number of the legacy serial device if more than one were on a daisy chained serial network.

 

Have you checked this?

Also check the documentation of the oven controller and see if it specifies a default Unit ID, or has someone changed it?

 

In context help for the MB Master FBs....notice the input on the top of the block it seems to allow one to set the Unit ID. (MBAP Header Input)

Looking at the .png I'd guess you were trying to read 2 registers starting at register 35 with a timeout of 10 seconds.

Nothing appears to be wired to the MBAP Header input.

 

As a last resort, you might try downloading modbus poll, and run it as the client (master) to your gateway server (slave), You can then quickly and easily change function codes, addresses and lengths and the Unit ID until you get a response that does not issue an exception.

 

Message 5 of 7
(4,075 Views)

I have tried the MBAP Header with what I think is the Unit ID and all I get is an exception 2 error.  As for the exception 1 error I got that to go away when I changed that read holding registers function to read input registers.  Now I can run the VI but it still is not reading.  The LED on the gateway device says that it is transmitting to the controller (the TxD light goes on) but it doesn't send any info back (the RxD light stays off). 

0 Kudos
Message 6 of 7
(4,051 Views)

Thanks guys I got it working!  I think that the NI Modbus library may be incompatable with the software that came with the gateway.  However I tried to use the simple Labview Modbus VIs under the Data Communication function pallette and it seems to work now.  And Ravensfan for the record I totally agree with you about not limiting myself to one protocol because they are going to be different anyway now that I'm not using the Modbus Library.  Ah well. Thanks anyway!

0 Kudos
Message 7 of 7
(4,035 Views)