Micrologix 1400 MODBUS RTU Master


Thread Starter


I am using an Allen Bradley Micrologix 1400 series B processor and creating messages to read/write data from Modbus configured gas meters.

I am having a difficult time trying to understand how to retrieve the data correctly - "single precision float" and "signed integers". it looks like the data always comes as either 1 bit or 16 bits from Modbus, therefore, how do I manipulate this data to look correctly in the Micrologix PLC? do you have any sample code?

Bob Peterson

signed integers are just 16 bit integers. they should be 16 bits long and copy into a micrologix N register simply.

floating point numbers can be a little difficult to work with. they require two consecutive 16 bit registers in the modbus data table. the two consecutive registers in the modbus data table have to be copied into an F register in the micrologix. you may find that the format of the floating point number in the modbus device requires some tweaking of the order of the two words to get the data represented correctly.
Floating point is 32 bits data structure that sent or transmitted by Modbus in form of two consecutive integer data files. In order to read data correctly, you need to convert that 2 consecutive integer data files into 1 floating point datafile using CPW instruction.

http://i430.photobucket.com/albums/qq21/aanjpg/Screenshot from 2015-08-05 200607_zps5ewqog5r.png

If you still get uncorrect reading, try to swap the two integer files first, before feed to CPW instruction.

Hope this help
Thanks, for the sample PLC code. By the way, this is the first Modbus circuit that I am about to configure.

Yes, through a lot of research using the AB Tech Connect website and reading as much about Modbus as possible, I am finding out that there is a lot of scattered information that I must compile.

I can see in the Ultima X Gas meter's instruction manual how they skip an address when the value is 32 bits. Also, AB explains to use the CPW which looks like one integer copied (but really 2 integers)into a floating point register.

The need to control all of the messaging from the PLC via Modbus is another factor along with writing to the addresses to modify values.
Another question. If the Gas Meter value is at address Base + 201, when I configure the MSG command, set the MB Data Address at 200 to get this value?
Okay, I will address the Micrologix PLC MSG instruction to begin at MB Database Address 200 when the Gas meter Modbus address begins at 201.
I am not at the site yet and wont be there for another 2 weeks. I'm trying to not make mistakes so that the project will go smooth.