I encountered a puzzling issue while working on my PowerFlex 70 drives connected to a L7 CPU using a 1788-EN2DN module. The drive is set up to transmit Logic command/status, ref/fdbk, and output datalinks A1,A2,B1,B2 for Output current, output power, fault codes, and more. In RsNetworx, the input data for the EN2DN is mapped as follows: - DINT[1] (cmd,stat,ref,fdbk) - DINT[2] (A1,A2) - DINT[3] (B1,B2) Within the PLC program, I need to transfer data from DINT[] to a User-Defined Type (UDT) using a copy command. Despite DINT[2] and DINT[3] not being directly linked to anything, the data somehow ends up populating into the UDT. Can anyone shed light on what might be causing this issue?
Welcome to the forum! The behavior you are witnessing is typical of the copy command, which transfers data from a source address to a destination. The amount of data copied is determined by the data type of the destination, such as a User-Defined Type (UDT) in your case. Your UDT should consist of 12 bytes of data, which explains why you are seeing 3 x DINT's being copied.
Chelton warmly welcomed you to the forum and explained the typical behavior of the copy command. When using the copy command, data is copied from the source address to the destination. The amount of data copied is determined by the data type of the destination, such as a User-Defined Type (UDT) which is usually 12 bytes in size. This means that the copy command will copy the data into the 3 x DINTs you are seeing. Thank you for clarifying how the length is referencing the destination element, it has provided a better understanding of the process.
When using COP and CPS, it is important to remember that the .Length parameter refers to the number of destination elements, not the number of bits, bytes, words, double-words, or 32-bit chunks. UDT data sizes are always in multiples of 4 bytes, making it easy to align when copying from a DINT[x] source. The amount of source bytes transferred will match the size of the UDT, but the length should still be input as the number of UDT elements. This ensures accurate data transfer for PLC programming.
I want to express my gratitude for your valuable guidance. Upon returning from the weekend, I took a closer look at the device net mapping and associated UDT in the program. Thanks to your insightful responses, everything has now become much clearer to me. Your help is greatly appreciated.
When working with ControlLogix (CLX) and CompactLogix (CPS), it is important to understand that the .Length parameter represents the number of destination elements, not the number of bits, bytes, or words. User-Defined Type (UDT) data sizes are always in multiples of 4 bytes, making it easier to align data when copying from a DINT[x] source. Even though the number of source bytes moved corresponds to the size of the UDT, the length should still be entered as the number of UDT elements. I recently encountered an issue while manipulating a UDT during a downtime window. The original UDT consisted of 16 status bits, a feedback INT, and 3 data link INT. Transitioning to a new drive with 16 Status bits, Feedback DINT, and a data link DINT, I faced problems copying data from my array to the UDT, particularly with the feedback portion not being transferred correctly. This discrepancy might be due to CLX organizing data in 4-byte groups, implying 16 unused bools situated between the status bits and feedback. It took me a moment to realize that the mismatch in data type sizes was causing the issue.
It sounds like you've got a tricky situation there! One possibility could be that the memory areas in the PLC are overlapping or that there’s a misconfiguration leading to unintended data being copied. It might also help to double-check the source and destination addresses in your copy command—sometimes, a simple oversight there can cause unexpected results. Additionally, if there's any logic that changes the way data is interpreted or manipulated before it hits your UDT, that could also be a factor. Have you tried using a debugger to step through the process and see where the values are coming from?
It sounds like you're dealing with some unexpected behavior in your data mapping. One possibility could be that there’s a misconfiguration in the way the UDT is structured or how the copy command is executed. If a UDT is defined to take data from DINT[1] but is inadvertently pulling in values from DINT[2] and DINT[3], it could be due to memory overlaps or uninitialized values in your data structure. Double-check your UDT alignment and see if there are any pointers or references that might not be set correctly. It might also be worth running a test by isolating the copy command to just one DINT at a time to see how each affects the UDT.
✅ Work Order Management
✅ Asset Tracking
✅ Preventive Maintenance
✅ Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Answer: 1. Why is data from DINT[2] and DINT[3] ending up populating into the User-Defined Type (UDT) even though they are not directly linked to anything? - The data from DINT[2] and DINT[3] may be populating into the UDT due to how the mapping is configured in RsNetworx or how the PLC program is handling the data transfer. It is essential to review the mapping settings and the copy command in the PLC program to identify the root cause of this issue.
Answer: - To troubleshoot communication issues, you can start by checking the configuration settings in RsNetworx to ensure proper mapping of input data. Additionally, verify the setup of the ControlLogix program for data transfer and communication with the drives. Checking for any errors or inconsistencies in the configurations can help identify and resolve the communication problem.
Answer: - Common causes of communication issues can include incorrect mapping configurations, programming errors in the PLC logic, faulty hardware connections, network configuration problems, or compatibility issues between the devices. It is crucial to systematically troubleshoot each potential cause to pinpoint and resolve the communication problem effectively.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.