How to Read Two 16-Bit Registers and Convert to Float in Micrologix 1400 with AcuDC Energy Meter

Question:

Hello everyone, I am currently working with an AcuDC energy meter that transmits data on voltage, current, and power via the RS-485/Modbus RTU protocol. The meter outputs floating-point values stored across two 16-bit registers, which I am attempting to read using a Micrologix 1400 microcontroller. Initially, I attempted to read these values as 32-bit data types; however, I encountered numerous errors. After conducting some research, I discovered that the energy meter does not utilize 32-bit registers—instead, it employs two 16-bit registers for storage. Consequently, I am now reading each measurement as two 16-bit registers and storing them in integer addresses. My next goal is to combine these integer addresses into a single floating-point address to facilitate mathematical calculations within the PLC. I’ve read that the CPW (Copy Word) instruction might allow me to copy the source integer address to the float destination with a length of 2. Unfortunately, this approach doesn’t seem to produce the desired result, as the float address remains at zero despite the source integers containing values. This situation leads me to believe I may be approaching the problem incorrectly. Additionally, I find the documentation on the CPW instruction in the Allen-Bradley Micrologix instruction set somewhat lacking. I would greatly appreciate any guidance or insights from those who have experience in this area. Thank you! --- By incorporating relevant keywords such as "AcuDC energy meter," "RS-485," "Modbus RTU," "Micrologix 1400," "CPW instruction," and "PLC calculations," this revised text improves SEO while maintaining the core message.

Top Replies

Have you experimented with a measurement of 1?

I experimented with the changes, but unfortunately, there was no improvement. To verify that the CPW is functioning properly, I modified the destination address from a float to another integer, and it confirmed that CPW is indeed active. I understand that the order of data is crucial; the first word represents the most significant bit (from the meter), while the second word denotes the least significant bit. Should I reverse their positions first? UPDATE: I attempted that approach as well, but the result remained the same—an empty float value. ANOTHER UPDATE: I’ve resolved the issue! It turned out that there was logic later in the program unintentionally writing zeros to this value. I also needed to switch the positions of the least and most significant words. Thank you for the assistance!

When working with a CPW, ensure that the length is set to 2. Additionally, you may need to adjust the order of words or even the byte order, depending on the configuration in the other device. However, if you are operating with integer values and still receiving zero in the destination—even with an incorrect length—it raises concerns that either the logic is not being processed correctly or that the destination is being inadvertently overwritten by other code.

I highly recommend implementing a mechanism to capture the math overflow bit while processing your operations. If your Control Processing Unit (CPW) executes concurrently with a partially completed Message (MSG), it may generate erroneous bits that could compromise the integrity of your results. This is especially critical in control systems where precision is paramount. To mitigate this risk, consider buffering the result by temporarily storing it in an alternate floating-point register. Only transfer it to the intended destination if the overflow bit remains unset. Although this scenario may seem unlikely, I learned firsthand that it can and does occur, particularly when dealing with data from a radio modem, which increases the chances of timing variability during the PLC scan cycle. By following these best practices, you can enhance the reliability and accuracy of your control systems, ensuring that critical operations are conducted without the risk of erroneous data.

We are collecting this data every 10 seconds, which means it's not essential for processing and serves mainly informational purposes. As long as any overflow does not result in an error that interrupts our operations, we should be fine.

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’