Labview Modbus Comm with Emerson Micromotion Flowmeters

R

Thread Starter

Regis

Hi,

I'm wondering if anyone has dealt with the Modbus communications (RTU) package contained within the Emerson Micromotion Coriolis flow meters.

To give you a little background, I'm new to Modbus code. I've recently been tasked with learning how to use it to communicate with said flowmeters in labview.

I downloaded the modbus labview code (created by Maarten Van Bree) here (http://www.air.nl/nlibrary/modbus_vi.html)

I then tested with it with the Modbus Serial RTU Simulator by Conrad Braam (http://www.codeguru.com/network/mod_rssim.html)
and had great success learning how to create commands etc... I was able to write data to the simulator as well as read data from it.

Since then, I tried the same format with the Micromotion Sensor and I do get a response from it (ie, a correctly framed response with CRC) but the meat of the data contained is always zeros. For example a sample command request might be:

0203 9C66 0001 4A76

where
02 = Modbus Unit Address
03 = Read Function
9C66 = 40038 = Starting Register
0001 = # of registers to read from
4A76 = CRC

and the return string (Read Holding Registers) might look like:

0203 0200 00FC 44

where
02 = Modbus Unit Address
03 = Read Function
02 = byte Count
0000 = "Supposedly contains data"
FC44 = CRC

Everything looks great except the string of '0000'. I should be getting non-data here and for some reason i'm not....

If anyone has any suggestions as to why data isn't appearing, please contact me at [email protected]

Thanks,

Regis
 
P

Preston Johnson

Good Morning,

My comment would be to work with the creator of the Modbus VIs and the Emerson Mocromotion flow meters. There may be settings in either the LabVIEW driver or the flow meter that are mismatched.

As an alternative, National Instruments also provides Modbus Drivers, and many others, in our OPC server CD. These are widely used Modbus Drivers and we support them. To learn more, go to

www.ni.com, and search for OPC or the direct link
http://sine.ni.com/apps/we/nioc.vp?cid=4584&lang=US

Thanks for the opportunity to comment.
 
A

Adam Crowder

Regis,

You've fallen victim to Modicon's strange method of distinguishing register spaces. They use a leading number (0, 1, 3, 4, or 6) to indicate a register space (Coils, Discrete Inputs, Analog Inputs, Holding Registers, or File Registers accordingly).

Often the first Holding register is written 4x0001 or 400001 but the 4 is only an indication of register space... To read this register use an opcode 3 (that takes care of the register space!) and a register number of 0x0000 (Modbus addresses are zero-based).

In other words, instead of using 0x9C66 to represent 400038, use 0x0025.

Regards,

Chas. Adam Crowder
Niobrara Research and Devlopment, Inc.
 
Thanks for the tip.

There were 2 things that I overlooked. Both were Modbus framing issues

1) Remember to subtract 1 from the address when creating the command. IE: I should've been calling address 37 instead of 38

2) I was using the address of "40038" instead of just "38" thinking that the address needed to be a 5 digit value. So for the above example, i should've created the command:

0203 0025 0001 95F2

where
02 = Modbus Unit Address
03 = Read Function
0025 = 37 = Starting Register (38 - 1 = 37)
0001 = # of registers to read from
95F2 = CRC
 
Top