CompactLogix Modbus via Prosoft MVI69-MCM

exileaustin

Member
Join Date
Jul 2011
Location
Calgary
Posts
8
Hello All,

Quick question regarding polling a Modbus device (NuFlo Scanner 2000 flow meter) with a AB CompactLogix and a Prosoft MVI69-MCM card.
I am getting data back from the device, however I am unable to make sense of it.
In the NuFlo user manual it tells me that all the Holding registers are Floating points (At least thats what I think FP means under data type). When I receive the data it is in 2 separate registers and the values are huge
Ex.
MCM.DATA.ReadData[24]= 16288
MCM.DATA.ReadData[25]= -6765
Do these 2 registers have to somehow be combined to get a value from them? If so, which command would I use in RS5000? I have tried using the COP command, and making the destination a real data tag.
Thanks in advance

Austin
 
Transporting Floating-Point values across networks that were built for 16-bit signed integers is a classic problem.

Are the ReadData and WriteData arrays in the MCM logic DINTs or INTs ?

If you COP those two Integer registers into a Floating Point register you get a value of about 1.25.

If the values were DINTs then you'd get one close-to-correct value, and one way off.

Remember that with the COP instruction the Length is the number of Destination Elements, not bits/bytes/words/dwords. A COP or CPS instruction with a Length of 1 will move four bytes from the Source into a single REAL type tag.
 
The values in the MCM data file are INTs.
So should I COP the INT file into a real tag with a length of 4?
I was trying it with a length of 1 on both of the registers. One would usually look ok and the other would be a number to a negative exponent.:confused:
 
I always have to do this by trial-and-error but it usually sorts out !

You're going to have to swap the Words from the MCM.Data.ReadData[x] array two-by-two, then perform a COP for every two MCM.Data.ReadData[x] elements into a single REAL tag.

Worth a thousand words:

Two INT to one REAL.jpg
 
you might have to swap the byte order on the scanner. I seem to remember the modbus on those being a funny.
 
Ok great I will try this tomorrow.
Does the CPS command copy both of the MCM data files into the single real register or do I have to configure it to do that?
What did you mean by swapping words 2 by 2?
Thanks in advance this has been very helpful
 
Ok great I will try this tomorrow.
Does the CPS command copy both of the MCM data files into the single real register or do I have to configure it to do that?
What did you mean by swapping words 2 by 2?
Thanks in advance this has been very helpful

The COP and CPS Copy Instructions are based on the Destination. So, if you are copying an Int to an Int, it will copy one to one. If the Destination is a Int to Dint or Real/Floating Point. It will copy two Ints to one Dint or Real.

The SWPB Swap Byte Instruction is used to move the Data around to get it in the right order. It may not be coming in on the Modbus in the correct High Byte/Low Byte order to match the IEEE Floating Point Format. Refer to the Instruction Reference.

http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1756-rm003_-en-p.pdf

Stu....
 
I took a closer look; SWPB won't work the way we want in this exact circumstance, so it's easier to just do it by hand.

The incoming REAL value is a 32-bit Floating Point packed into two adjacent 16-bit Integer Modbus registers.

To use this value in CompactLogix, you need to swap the order of the Modbus integer registers, then copy all four bytes (32 bits) into a REAL tag.

The COP instruction takes its Length from the number of destination Elements. Since the Destination is a REAL, which is 32 bits long, the COP takes 32 bits (two INTs) and packs them into the destination REAL. COP copies the data bit-by-bit and doesn't attempt to change the data types like MOV does.

Two INT to one REAL with reverse and scratchpad.jpg
 
Also: This issue is common enough with Modbus protocol that Prosoft includes a "Swap Code" setting in every MCM module Command.

In this case you would set it for "Word Swap" and would not need the scratchpad array or the two MOV instructions, just the COP.
 
Great it worked! All I needed was the Word Swap in the Prosoft configuration builder and the COP instruction. Thanks everyone for their help, much appreciated.:p
 

Similar Topics

Client's Customer has an L64 v20 with MCI56-MCM Modbus in 2 slots. Client has an 1769-L16ER-BB1B v20 that needs to communicate with the L64 via...
Replies
3
Views
2,281
I am attempting to use a ControlLogix processor and a Digi One IAP, to read from several Modbus RTU slaves(GE Multilin motor protection relays)...
Replies
7
Views
6,609
Hey guys, A couple of quick questions but first a layout of what I'm working with. Compactlogix 1769-L37erm controller. The current system we...
Replies
2
Views
1,225
Going to preface this by saying I am a complete modbus newbie, so apologies if my terminology is off... We have a Prosoft PLX31-EIP-MBTCP modbus...
Replies
3
Views
1,324
Hi Everyone Ive got an AB 1769-L33ER (i read its modbus compatible) and im looking to communicate with a Chinese multi controller via Modbus. Ive...
Replies
6
Views
2,266
Back
Top Bottom