Sign in to follow this  
Followers 0
Guest Amanda

ControlLogix

10 posts in this topic

I am currently communicating with a micromotion through a modbus module configured in my ControlLogix PLC. I have spoke to micromotion several times and am having a hard time understanding what they are trying to tell me. They have two Integers that get sent for a particular address that should get combined into a floating point. What they are telling me is the address structure for the micromotion is 3412 and that the PLC is 1234 so I have swapped my integers. The values I am receiving back Int[0]=16544 and Int[1]=0 which when copied into a float/dint gives me 16544. However micromotion is telling me that this value in a float gives me 5.0. Any suggestions as to what I am missing?

Share this post


Link to post
Share on other sites
By swapping words you can switch between "intel" and "motorola" formats (little vs. big endian). then this should be as simple as using COP instruction to stich the two and put them into F register. To find more about topic search the web for IEEE real (or real32) presentation of float type here is a sample http://www.math.byu.edu/~schow/work/IEEEFl...oatingPoint.htm or http://msdn.microsoft.com/library/default....t_languages.asp

Share this post


Link to post
Share on other sites
hmmm... sorry didn't notice you are using CLX but principle is the same. i don't have PLC at hand to try it out but the two 16-bit integers should be part of an array such as my_ints[2] and my_ints[3]. the target should be declared as a real and then you can use COP instruction....

Share this post


Link to post
Share on other sites
I've tried that and it's not quite working out that easy. I'm attempting RS tech support currently.

Share this post


Link to post
Share on other sites
Attached clip shows what you want.

Share this post


Link to post
Share on other sites
Floating Point numbers (REAL datatype) and Double Integer (REAL) datatypes are both 32 bits long, but they are not the same. REAL datatype tags in ControlLogix use the IEEE 754 single-precision format. You can read up on it and understand the whole mantissa / exponent thing if you like. Think of that pair of INT array elements as hexadecimal, where 16544 = 0x40A0 hex. INT[0] = 16544 dec = 40A0 hex INT[1] = 0 dec = 0000 hex If you were to COP both of these into a REAL datatype tag (use Length 1 in the COP instruction), the first element would go in the lowest two bytes, and the hexadecimal representation woul be like this: REAL = 000040A0 hex Check how that would convert to a floating point number using this website: http://babbage.cs.qc.edu/courses/cs341/IEE...E-754hex32.html You will see that in that order, those values translate into... well, some very tiny number. In this order, though: REAL = 40A00000 hex = 5.0 floating-point decimal You could use the Swap Bytes instruction, or you could just set up the INT array elements in the right sequence before you use the COP instruction to move them into a REAL datatype tag.
1 person likes this

Share this post


Link to post
Share on other sites
Amanda, Which modbus module are you using with your ControlLogix? I just did a project with the ProSoft MVI56-MCM and Micromotion 2700 series. ProSoft's tech support was quite good. If you are using the ProSoft module, the sample program makes a pretty good starting point. You should not need to swap bytes in the ladder, that option is provided in the modbus command you set up in the module UDT. For my project, it really was as simple as: COP IntArray[0] Real 1 Good Luck, Mike Ellis

Share this post


Link to post
Share on other sites
Depending on which Micro Motion Flow Transmitter you are talkiing to, you may have the ability to reorder/swap the float bytes from the transmitter side. Also, some Modbus Polling Masters/OPC Servers have a float byte swapping feature. I always have to fiddle around with byte swapping settings on Micro Motions but we only talk to MVD core processors and sometimes 9739's. Edited by flopro

Share this post


Link to post
Share on other sites

Amanda I think they are trying to tell you is that the PLC is big-endian,  and the micromotion is little-endian.  It's something that is corrected/converted mostly automatically, but not here.  The wikipedia article on 'endianness' is pretty good: https://en.m.wikipedia.org/wiki/Endianness  

Unfortunately in your specific case the problem is being made more confusing by the complicated way in which REAL numbers (that is numbers with a decimal point) are stored.

I'm new at this.  Are ControllLogix PLC's big-endian?

Eddie your answer is amazing. I couldn't use your link though.  Here is a shortened link to the same place: https://goo.gl/Jmt9D2

I found this piece that very nicely explains IEEE 754:  http://www.oxfordmathcenter.com/drupal7/node/43

Edited by fEsTiDiOuS
Expand and clarify

Share this post


Link to post
Share on other sites
12 hours ago, fEsTiDiOuS said:

Amanda I think they are trying to tell you is that the PLC is big-endian,  and the micromotion is little-endian.  It's something that is corrected/converted mostly automatically, but not here.  The wikipedia article on 'endianness' is pretty good: https://en.m.wikipedia.org/wiki/Endianness  

Unfortunately in your specific case the problem is being made more confusing by the complicated way in which REAL numbers (that is numbers with a decimal point) are stored.

I'm new at this.  Are ControllLogix PLC's big-endian?

Eddie your answer is amazing. I couldn't use your link though.  Here is a shortened link to the same place: https://goo.gl/Jmt9D2

I found this piece that very nicely explains IEEE 754:  http://www.oxfordmathcenter.com/drupal7/node/43

This topic is 13 years old, and Amanda isn't even a user anymore...  

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0