maexio
Lifetime Supporting Member
Hello,
I have been looking for a reference for the order that a UDT is copied in the COP instruction.
More specifically - I have a set of code that used an unprotected COP on an array of UDTS that were changed in a higher priority event task. Due to the size of the array and udts a CPS was not used (to prevent motion issues) and I stupidly didn't think or know of a UID / UIE pair to prevent data integrity issues.
My code now correctly uses a UID / UIE pair before cop of the data, but the symptom of the problem will only be corrected if the UDT data is copied in a specific order, which I can't find anywhere.
More Specifically i have an array of UDT's of the type 'Board' and it has approximately 30 DINT subtags ordered as follows :
ID (Position 0)
Tag 1
Tag 2
Tag 3
Tag 4
...
Tag 20
Tag CriticalCondition
..
Tag 29
If I do a COP Board[5] to TestBoard with a Len 1 -> and an event task interrupts the COP and moves Board[4] -> Board [5] (after moving board [5] -> board[6]...)
Depending upon where the COP is in the interrupt - this could explain my problem. BUT only if the COP copies in the following order :
Tag 29 - Tag 29
Tag 28 - Tag 28
....
Tag 1 (ID) - Tag 1(ID)
That way i could be doing a check that ID NEQ OldID -> MOV ID OldID and have the Tag 21 (CriticalCondition) not be representative of the data i'm trying to 'one shot' with my stored 'OldID' condition.
If however it copies Tag 1 -> Tag 1 then Tag 2 - Tag 2, and so on - My problem still exists and I want to solve it before updating a bunch of locations its used in.
That said -> I know the COP copies data in 32 bit groups, but not the order it copies within a UDT and can't find anywhere on KnowledgeBase or in google searches that clarifies it.
Much thanks in advance, as this issue has me quite distracted trying to find another source of the issue.
I have been looking for a reference for the order that a UDT is copied in the COP instruction.
More specifically - I have a set of code that used an unprotected COP on an array of UDTS that were changed in a higher priority event task. Due to the size of the array and udts a CPS was not used (to prevent motion issues) and I stupidly didn't think or know of a UID / UIE pair to prevent data integrity issues.
My code now correctly uses a UID / UIE pair before cop of the data, but the symptom of the problem will only be corrected if the UDT data is copied in a specific order, which I can't find anywhere.
More Specifically i have an array of UDT's of the type 'Board' and it has approximately 30 DINT subtags ordered as follows :
ID (Position 0)
Tag 1
Tag 2
Tag 3
Tag 4
...
Tag 20
Tag CriticalCondition
..
Tag 29
If I do a COP Board[5] to TestBoard with a Len 1 -> and an event task interrupts the COP and moves Board[4] -> Board [5] (after moving board [5] -> board[6]...)
Depending upon where the COP is in the interrupt - this could explain my problem. BUT only if the COP copies in the following order :
Tag 29 - Tag 29
Tag 28 - Tag 28
....
Tag 1 (ID) - Tag 1(ID)
That way i could be doing a check that ID NEQ OldID -> MOV ID OldID and have the Tag 21 (CriticalCondition) not be representative of the data i'm trying to 'one shot' with my stored 'OldID' condition.
If however it copies Tag 1 -> Tag 1 then Tag 2 - Tag 2, and so on - My problem still exists and I want to solve it before updating a bunch of locations its used in.
That said -> I know the COP copies data in 32 bit groups, but not the order it copies within a UDT and can't find anywhere on KnowledgeBase or in google searches that clarifies it.
Much thanks in advance, as this issue has me quite distracted trying to find another source of the issue.