Converting PLC Data from Two Integers to Real Value: Addressing Conversion Discrepancies

Question:

In my current project involving ladder logic programming with an Allen Bradley PLC and an Anybus ABCC module, I am tasked with handling 32 inputs and 24 outputs in the form of arrays of integers. The challenge I am facing is converting this data into either DINT (Double Integer) or REAL format using instructions like COP or CPS, as I am encountering discrepancies in the values. The first value in the input data, MaxFlow, is represented by 4 bytes spanning the first two registers. When attempting to convert Input[0] to DintValue with a length of 1 using the COP instruction, I am not getting the expected result but instead a significantly larger number. Additionally, the system includes a Cooperion Feeder equipped with an Anybus CompactCom 40M module for Ethernet/IP communication. To properly handle the inputs and outputs, I need to configure the mapping for the I/O settings in the PLC, specifically defining parameters such as protocol, baud rate, parity, Ethernet/IP settings, input and output block sizes, as well as the register mappings for various data points such as MaximumFlow, Setpoint, Totalizer, and others. Ensuring accurate communication and data conversion between the PLC and the Anybus module is crucial for the successful operation of the system, requiring a thorough understanding of the setup and configuration for seamless integration. By correctly setting up the I/O mapping and addressing any conversion discrepancies, I aim to optimize the performance and reliability of the overall system.

Top Replies

One effective method is to individually map each BOOL from the INT to the DINT. Alternatively, you could utilize a BTD instruction to assign one INT to each "section" of the DINT. This approach can help optimize data mapping and improve efficiency in PLC programming.

One possible solution is to map each BOOL from the INT to the DINT separately. Alternatively, you could utilize a BTD instruction to map one INT to each half of the DINT. Another option is to use the BTD to map two INTs into a DINT and then copy the DINT to Real. This method was successfully implemented on a Schenck weigh controller by PiNkYnotBrain.

Do you have an example of two 16-bit integer values and the corresponding 32-bit REAL values they are meant to represent? Also, what is the 32-bit REAL value you receive from the COP two_ints[0] one_real 1 instruction? Let's explore a practical demonstration of converting integers to REAL values.

It sounds like you're dealing with quite a complex project! My guess is that the issue with your COP instruction could be due to byte ordering or 'endianness'. Allen Bradley PLCs use little-endian byte ordering, which means the least significant byte is at the lowest address. If your input data is coming in as big-endian, this could explain why you're seeing larger than expected values. Try swapping the order of your bytes before the conversion. In regards to configuring the I/O settings, it's essential to ensure consistency between the Anybus module and PLC. Both should operate under the same protocol, and the baud rate needs to be synchronized as well. Your mention of accuracy couldn't be more spot on - it's absolutely paramount here. Don’t forget to look into the user manual of your specific Cooperion Feeder as well. There might be some specific troubleshooting tips or instructions for interfacing with PLCs that could be beneficial for your project. Good luck!

It sounds like you're dealing with quite a complex project at the moment! One thing that comes to mind about the discrepancies in the DINT values could potentially be due to endian-ness. Allen Bradley PLCs handle bytes in little-endian, whereas Anybus might be using big-endian, so that's definitely something worth checking. In regards to the I/O mapping, you're spot on about its importance. Defining parameters accurately is critical, but also consider spending some time double-checking your fieldbus configuration on both PLC and Anybus module ends using your HMS NetTool. The better your settings match on both ends, the smoother your data exchange will be. Keep at it!

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)

FAQ: 1. What is the challenge faced when converting PLC data from two integers to real value using instructions like COP or CPS?

Answer: Answer: The challenge involves encountering discrepancies in the values during the conversion process, leading to unexpected results such as significantly larger numbers than anticipated.

FAQ: 2. How is the first value in the input data, MaxFlow, represented in the PLC system involving ladder logic programming with an Allen Bradley PLC and an Anybus ABCC module?

Answer: Answer: The first value, MaxFlow, is represented by 4 bytes spanning the first two registers, requiring careful handling during the conversion process to ensure accuracy.

FAQ: 3. Why is it important to configure the mapping for I/O settings in the PLC when working with devices like the Cooperion Feeder and Anybus CompactCom 40M module?

Answer: Answer: Configuring the mapping for I/O settings is crucial to define parameters such as protocol, baud rate, parity, Ethernet/IP settings, input and output block sizes, and register mappings for data points like MaximumFlow, Setpoint, Totalizer, and others, ensuring accurate communication between devices.

FAQ: 4. How does addressing conversion discrepancies between the PLC and the Anybus module contribute to optimizing system performance and reliability?

Answer: Answer: By addressing conversion discrepancies and setting up the I/O mapping correctly, seamless integration and accurate data conversion can be achieved, ultimately optimizing the performance and reliability of the overall system.

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  β†’