Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between Labview and Controller via Modbus protocol

Hi,

 

I’m trying to create a testing environment for temperature and humidity with Labview. My problem is that I can’t communicate with the device which controls parameters. My equipment is the following:            

     -West 4400 ¼ Din Profile controller             

     -USB485ui serial adapter from Amplicon

 

Communication protocol is Modbus RTU. I tried to communicate and to send modbus command with Hyperterminal, Labview VIs (Looppack or Modbus pack) and others softwares but I can’t get any response from the device. Visa detects it on COM port. It seems that the device is connected but I must send bad commands to it. Is there any simple mean to chek that a modbus device is communicating ?

I’m just a beginner in modbus protocol so if someone could give me any help or advice, it would be great.

Thanks.

Message Edited by Genjis on 05-18-2010 10:40 AM
0 Kudos
Message 1 of 7
(5,609 Views)

Hi Genjis,

 

How do you now that the commands are bad ?

 

Do you get a error number from your VI ?

 

Are your sure that the serial line settings are correct (baudrate, parity, databits) ?

 

Did you disable the terminate character ?

 

Can you show your VI that you use to communicate ? 

 

If you want to send a loopback command with a simple communication VI you can use the following code: 0x01, 0x08, 0x00, 0x00, 0xAA, 0x55, 0x5E, 0x94

This is the loopback command (with CRC) to ModBus slave with address 1. The device you response with the same data.

 

 

0 Kudos
Message 2 of 7
(5,586 Views)

Hi K C,

 

I'm not sur that my command is bad, I don't get any error number from the device (except with modscan32).

 

The settigns are: baudrate: 9600, data bits: 8, parity: none, stop bite: 1, flow control: none. I've cheked it on the device (except for stop bite and flow control)

I'm using Labview 2009 and the VI Modbus library from NI available at:

http://sine.ni.com/devzone/cda/epd/p/id/4756

 

In fact my problem is that I don't really know how to send commands in Modbus. I've undanrstood the message format but can I send one of those message directly as a string ?

 

I tried to send Loopback command with a software like modscan32 but I can only choose between few modbus fonctions. Do you know another good software  to send modbus commands simply ?

 

Thank you,

 

Message Edited by Genjis on 05-19-2010 03:20 AM
0 Kudos
Message 3 of 7
(5,580 Views)
You can use the 'Basic Serial Read Write' example to send the hex data for the loopback command.
0 Kudos
Message 4 of 7
(5,569 Views)

Thank you KC,

 

Apparently it works with the MB Serial Master Query.vi . It seems that I didn't give the good adress to read parameters. The quantity of bytes for each parameters seems to have its importance too. Now I can access and modify data on the controller.

 

Nevertheless, I didn't find how to send your own command with VIs. I used a simple software to send the loopback command. It's Simply Modbus available here: http://www.simplymodbus.ca/index.html

Maybe it will interest someone.

 

I will use MB Serial Master Query.vi  as a subvi to realise my operations and get further.

Thanks for your help.

 

 

 

 

0 Kudos
Message 5 of 7
(5,557 Views)

Hi,

I am now able to fully control the West device, but I am having troubles when I try to add others slave devices. I am trying to control the environmental chamber and to read data from sensors simultaneously.

 

The two devices are communicating with Modbus RTU on the same serial RS485 port. I found that it is a common problem when you are connecting two slave devices on the same serial port. Timeout Error are occurring and it looks like the Labview serial function can’t read and write data on both devices at the same time. It works well in highlight or step mode but not in continuous mode.

 

Is it possible to connect two modbus devices on the same com port and to communicate with both on Labview ?

Many thanks

 

Message Edited by Genjis on 05-27-2010 03:52 AM
0 Kudos
Message 6 of 7
(5,472 Views)

Hey send me your working vi at

ankith_sadvidya@yahoo.co.in

 

 

Thanks in advance 🙂

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