Troubleshooting COP Instruction in AOI on Studio 5000

Question:

Hello, I am attempting to implement a Copy (COP) instruction within an Add-On Instruction (AOI) in my program. However, it seems to be ineffective. My goal is to transfer a Double Integer (DINT) value to a Signed Integer (SINT) array. Can you please advise on why this functionality is not performing as expected?

Top Replies

Incorporating a COP instruction within an AOI (Add-On Instruction) may not be functioning as expected for a user named Revnus. The goal is to copy a DINT (Double Integer) to a SINT (Single Integer) array. However, there seems to be an issue with the setup. The reason for this could be due to the difference in bit sizes between a SINT (8 bits) and a DINT (32 bits). To troubleshoot this problem, it is important to take into consideration the length of the SINT array being used. The COP instruction relies on the destination data type to determine the number of bytes to copy from the source. In this case, since a SINT is 8 bits and a DINT is 32 bits, multiplying 2 by 8 gives the answer. If the length of the SINT array is not properly adjusted to accommodate the data being copied, it could explain why the instruction is not working as intended. For further guidance on resolving this issue and ensuring the successful copying of data, additional adjustments may be required in the setup.

According to robertmee, a SINT is represented by 8 bits while a DINT consists of 32 bits. How many SINT values does your array contain? Find out by clicking to expand the array, with a length of 20 elements.

Revnus mentioned the importance of understanding how COP uses the destination data type. Refer to the information provided above for more details. Explore the functions and applications of COP in handling destination data types for optimal results.

When using the COP function to transfer a single DINT Ref_Max to 4 SINTs located at DriveOut[8] through DriveOut[11], the Length parameter should be set to 4. The Length array indicates the number of Dest types being transferred.

The decimal value can be accommodated within a 16-bit system. I aim to exclusively utilize Driveout[8] and Driveout[9]. If the COP instruction is failing in my AOI block due to this reason, I may consider switching the source type to INT.

Hey there, it sounds like you're on the right track but you might be hitting a snag due to type compatibility. DINT to SINT conversion isn’t as straightforward. When a DINT value is copied to a SINT array, only the lower 8 bits (or one byte) of the DINT's binary representation gets copied into each SINT element, possibly giving you an unexpected result. You might want to consider splitting the DINT into its four constituent bytes first, and then copying these bytes individually into your SINT array. Hope this helps!

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. Why is the Copy (COP) instruction within an Add-On Instruction (AOI) not working as expected for transferring a Double Integer (DINT) value to a Signed Integer (SINT) array?

Answer: - The issue could be related to the data types being used and how the instruction is implemented within the AOI. Ensure that the data types are compatible and that the COP instruction is correctly configured within the AOI logic.

FAQ: 2. How can I troubleshoot the ineffectiveness of the Copy (COP) instruction within the Add-On Instruction (AOI) on Studio 5000?

Answer: - You can troubleshoot the issue by checking the data types, the configuration of the COP instruction, and the logic within the AOI. Verify that the input and output data structures are correctly defined and that the instruction is being executed properly.

FAQ: 3. Are there any specific considerations or limitations when using the Copy (COP) instruction within an Add-On Instruction (AOI) on Studio 5000?

Answer: - Make sure that the data types being copied are compatible and that the COP instruction is supported within the AOI implementation. Check for any restrictions or specific requirements outlined in the Studio 5000 documentation for using the COP instruction within AOIs.

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