Sign in to follow this  
Followers 0
rajsiyer

ML1100 as Modbus Master reading floating points data

11 posts in this topic

Hi fellas... Thanks to Ken Moore, Bob Foot and Shanen here, I managed to communicate a ML1100 as Modbus master to read in data from energy-meters, which store parameters like KwH, KVAR, etc in their registers as a pair of 16-bit integers, so that a SCADA client could poll them as real numbers with decimal points. As many of you all know, the way one reads a real number stored at the register pair %MW90-MW91, would be to read the data as a Modbus item "40092 F". For example, in Excel one would have to write <=MODBUS|Topic_name! 400092 F> the F being the specifier for floating point data. To my chagrin I found that ML1100 does not read in floating point numbers. The registers in the energy meters are all 2 consecutive 16 bit integers. How does one go about displaying these register pairs as floating point numbers in Excel??. I would really, really appreciate anybody helping me out with this. There has to be a way around. Regards, best wishes Raj S. Iyer

Share this post


Link to post
Share on other sites
I am not sure if this is your problem, but Modbus usually swaps words, sending MSB first AB platforms sending LSB first, so simply swap words to see if it helps. As float uses 4 bytes you may need to swap bytes as well

Share this post


Link to post
Share on other sites
Thanks sir, Will try it out though I've not seen it happen. Mapping of data blocks between source and destination is supposed to be protocol independent.Even if what you say happens, the user of Modbus is not expected to arbitrate this. Modbus is an interface with 'handles' provided in the form of function codes. The user is not required to go beyond using these function codes. The same function codes will behave identically irrespective of hardware and also independent of the Physical Link ie whether RS-232/485 or Ethernet. Of course there are more functions in different packages such as MbPlus or MbEnet. But they all honor the basic requirements of the Modbus protocol in general and offer all the common functions. That is to say, any make of PLC, with a Modbus ASCII/RTU port will have to talk identically, with any 3rd party make of Modbus enabled devices as slaves. Regards, best wishes and promising to post my findings in this matter that widely concerns us all.. Raj S. Iyer

Share this post


Link to post
Share on other sites
See this TN http://rockwellautomation.custhelp.com/cgi...amp;p_topview=1

Share this post


Link to post
Share on other sites
Raj, I certainly agree that Modbus should be implementation-independent. But in the real world, it's just not. Folks who implement Modbus in embedded systems take all kinds of liberties in bit significance and byte order. Datatype is not explicit in Modbus function codes. And even if it is, there's no reason for byte order to be the same inside an A-B controller as it is inside a Modicon controller. Since your HMI application wants to read A-B datatypes, you're going to have to give it what it wants. For your application, if the data is coming over the Modbus RTU connection encoded as IEEE 754 single-precision floating point values but being stored in A-B integer data files, you need to use the COP instruction to copy the data bit-by-bit into an A-B Floating Point data file. You can then read that Floating-Point data file with your display system. For example, if you have three 32-bit IEEE 754 single-precision floating point values stored in the MicroLogix 1100 in Integer data elements N10:0-5 (six 16-bit registers), you use the COP instruction as follows: COP Src: N10:0 Dst: F8:0 Len: 3 If the data in the Modbus registers you've read into the Integer registers is in the appropriate byte order, you'll see the values you expect. If it's not, you need to swap the bytes or swap the words. If you can post the actual values in your Integer data file, and what values those are expected to represent, that will help. Edited by Eddie Willers

Share this post


Link to post
Share on other sites
This will work with slc 5/03 & above the method in the technote has to be used for micrologix

Share this post


Link to post
Share on other sites
Boss..Praveen, Are you telling me that this has to be implemented in the Ladder Logic??? or is it in the SCADA client Pl. reply, I'm eager to know

Share this post


Link to post
Share on other sites
An oversight by me; I was using an emulator, which doesn't support the MicroLogix 1100 operating system. In the MicroLogix family, the CPW (Copy Word) is insensitive to data type size mismatches. Use it instead of COP to make this data reformat in the MicroLogix. How about those values, Raj ?

Share this post


Link to post
Share on other sites
OK Fellas... A Big Thanks to Eddie, Praveen and especially to ContrConn and all others who expressed their views here, I've managed to solve this issue. The gist is..MODBUS DOES SWAP BYTES!!!!. It is easily resolved by first swapping the registers, and then swapping the bytes within each register. At first even this did not seem to work .. But by taking care to move the higher register first, it works. ie. if you were to move the register pair 40001-40002 to F8:0 , map the message instruction to have them delivered at say N10:0 &n10:11 respectively. Then take care.. MOVE N10:11 TO N10:0 AND then N10:11 TO N10:0, IN A LOWER RUNG or in the next scan cycle. A OSR pulse then swaps the bytes within N!10:0-N10:1 and in the same rung a CPW instruction in parallel with the swap (but placed lower!) moves them to their destination at F8:0, with a length of 2 words. Since I've to move hundreds of words, I've to construct a reliable shift register or counter based loop. This program logic, I've not posted as its still half baked!! Will welcome ideas though with all gratitude. Ah! There's one last thing... Praveen wasn't quite right when he says that the CPW method wont work. It is a delight to find that it does. And Thanks to him though, for through his links pasted here, I've discovered a treasure trove of AB material .. Regards, best wishes Raj S. Iyer

Share this post


Link to post
Share on other sites
I expessed that Cop inst won't work in micro series for IEEE convertion & also I don't have the rs500 to checkup with anyway greets for your success

Share this post


Link to post
Share on other sites
This is an old thread but I found this helpfull troubleshooting this issue and figuring out whats going on when talking Modbus with a Micromotion MFM... http://www.61131.com/download.htm Enjoy Edited by Scottus

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