Studio5000 Convert a UDT array to a DINT array

timryder

Member
Join Date
Feb 2007
Location
Macomb MI
Posts
176
I have a Structure in my project which has a few nested UDTs. They are ultimately of type DINT. What I would like to do is copy the values out of the UDT array into a simple DINT array but I don't know how I can loop through it's members programmatically since I can't use an INT as a pointer.

Are there any tricks with Studio5000 I don't know about for copying members of a structure into another of the same Data Type? I tried CPS but it didn't work since they aren't the same. At least I didn't see it working correctly.

Here are the specifics:

A structure which has Each Day of the week as a UDT (7 members).
Each Day has 8 DINT entries named Start_1 Stop_1, Start_2 Stop_2 etc. As a UDT. So a total of 56 DINTS for the whole structure.

I want to numerically parse each value of the entire structure (56 DINTS) and compare it's value but I don't have a nice way to loop through the structure. So I thought I would copy the values into a simple DINT[56] and then evaluate that programmatically with a pointer. But the Copying is going to be tedious if I can't find a better way to do it.

Any thoughts?
 
Nope... Same result.

Attached are the screen shots.
The original "Structure" and the "Result" from the COP instruction

It's the same result as the CPS.

Code:
COP(in_OT.Asset[in_AssetNumber].Shift.Schedule, int_TimeArray[0],56);


EDIT: I can see that the data is repeating, so it's copying something. But the value isn't the same?

Structure.jpg Result.jpg
 
Last edited:
Problem Solved....

User error... I had dissimilar data types. The Source was INT the Dest was DINT.
Once I fixed that everything worked.

Thanks anyways.
 

Similar Topics

Hi all, I have a question on how to hande data that i read from a sensor (type IFM) trough IO-Link (1734-4IOL) I get 2 SINT's (SINT[0] and...
Replies
2
Views
686
Hi I need to convert a DINT with HEX value e.g A0F15663 to a string with the same value 'A0F15663'. Any tips of good instructions to use ...
Replies
11
Views
3,387
Customer has a program running in a 1769-L19ER-BB1B FW ver. 30 controller and bought a used machine with a 1769-L23E-QBFC1. Can we convert the...
Replies
4
Views
1,392
I have an array of 55 REAL values. Is there a way to multiply based on the array location ? I have 55 transfer belts that are equally spaced...
Replies
3
Views
153
Hi Hope you all are doing well. Iam working on a project with some AOI. I also hate no online edits... lol. My problem occurs when I use a UDT...
Replies
2
Views
157
Back
Top Bottom