LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Ethernet read and write to a Eurotherm 6180XIO Modbus server using LV8.2 shared variables

I am having EXTREME difficulty trying to establish communications with a Modbus device using LV8.2 shared variables.  The device is a Eurotherm 6180XIO Datalogger configured as a Modbus master.  The PC and a cFP-1804 are slaves.  All IP addresses are set correctly.  This approach using shared variables would seem simple, but I can't find any examples or proper guidance on how to get it working.  I am trying to avoid having to mess around with TCP/IP, OPC, or any other old-fashioned method.
 
I have read many threads on related topics but none directly apply to this situation.  I have created a library containing a Modbus I/O server and shared variables bound to read and write holding registers.  I have followed all recommended tips for creating such variables but I can neither read or write data.  All data types are U16 due to Modbus protocol limitations.  I have also applied the LV x10 factor in the most significant digit in the register offset (6 digits instead of 5).
 
I have a cFP-1804 on the same network which reads into the datalogger OK.  The registers I use are 31000 (for CH0 on module 0, 31002 for CH1, etc) and the data can be read as FLOAT32.  I have updated the firmwate on the 1804 to the latest level.  I cannot even get shared variables to read SGL values.  Using registers 301001 for CH0 and 301002 for CH1 I can only read U16 values, and not a 2-word SGL.
 
Third party Modbus simulation software is able to write to and read from registers very easily, but not LabVIEW.
 
Some questions are:
- do I use a Modbus master or slave as an I/O server in the library as a target for binding the shared variables?
- is there some other wierd translation in register offsets between LabVIEW and traditional Modbus?
- is this actually possible using shared variables or am I wasting my time?
0 Kudos
Message 1 of 7
(4,785 Views)
 I will have a further look into reading 32 bit values from a FP device and hopefully I can come up with some example code. As to the eurotherm controller I'm not sure why you can't read any values, are the registers all 16bit, are there any 1bit (boolean) ones you can try?

Regards

Jon B
Applications Engineer
NIUK & Ireland

Message Edited by JonBowers on 02-13-2007 08:14 AM

0 Kudos
Message 2 of 7
(4,780 Views)
 I have rewritten my test example and have figured out which register addresses to set for the shared variables.  It seems to make sense now.
 
My problem now is that I need to write to a sequential block of 30 registers on the datalogger in order to display and log a message string.  Each 16-bit register holds two ASCII characters (ie. 60 char message length).  To do this with 30 shared variables will be very cumbersome, especially if I have to write to several of these blocks.  Is there another way I can do this using TCP/IP writes?  I know the datalogger IP address but not its remote port.  I have tried to do this but without success.
0 Kudos
Message 3 of 7
(4,766 Views)
Hi Mike,

There is also a Modbus library for LabVIEW so if you can use that to comunicate with the Eurotherm device. It is a free download from our website at the following link:

http://sine.ni.com/nips/cds/view/p/lang/en/nid/201711

Alternatively you can use some of the DSC functionality to programatically create shared variables and bind them to the correct addresses, or use one SV and change the binding.

Regards

Jon B
Applications Engineer
NI UK & Ireland
0 Kudos
Message 4 of 7
(4,762 Views)
You might be able to do it with one variable. Instead of numeric format for the variable, try using string(ASCII) as the datatype. Then you can specify the length of the message. The only issue is that the bytes in the message can never be zero. A zero (Nul) value terminates the string. This worked in v7.0  DSC. I don't have version 8.2.
0 Kudos
Message 5 of 7
(4,758 Views)
Sending the whole 60-character string using a string or array would be the most efficient.  I have tried both methods, and these only cause the datalogger to flag a message log but no text is displayed.
 
For a string variable, I have used the following binding "My Computer\Modbus Test.lvlib\ModbusServer6180\442305", where ModbusServer6180 is a Modbus I/O server configured with the logger IP address, and 42304 is the register offset at the start of the text block in the logger.  I need to write to 30 consecutive registers starting with this one.  I am not using buffering and have not enabled single writer.
 
Can anyone confirm whether this method should work in 8.2?
 
Does the string need a special termination character?
0 Kudos
Message 6 of 7
(4,734 Views)

I'm still trying all sorts of things, but cannot get LabVIEW 8.2 shared variables to write a block of registers at the same time.  It would seem the Eurotherm device is expecting the whole string to be written using the Modbus multiple-register write function.  Is there a way of grouping variables or using an array or a string type variable to write to a consecutive block of registers at the same time?

I'm starting to get desperate now because the project demands that a string message is written to the Eurotherm.

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