COP a dint to Bool[32]

asterof

Member
Join Date
May 2007
Location
Califonia
Posts
554
tried to use a COP length of 32 to copy a DINT to a
BOOL[32]
Does not work
Tried a move also but of course that did not work
CLX L83
Tried a BTD also, no luck, what am I missing
 
You're not missing anything. BOOL arrays are the devil. Don't use them.

Instead of a BOOL[32], just use a DINT and address the individual bits - DINT_Tag.0, DINT_Tag.1, etc.

If you need to use indirect addressing, you just need to add the square brackets around the pointer, after the point, e.g.

DINT_Tag.[Pointer]
 
You can create UDT with 32 BOOL elements, then create a tag using this datatype. It will be aligned with one DINT.
Otherwise each BOOL takes one DINT
 
You can create UDT with 32 BOOL elements, then create a tag using this datatype. It will be aligned with one DINT.
Otherwise each BOOL takes one DINT

Unfortunately this approach doesn't allow you to indirectly address the individual BOOL elements.

What I do in these circumstances, is to create a UDT as a container for a BOOL Array, then the tags created of that UDT can use indirection.

Example....

My UDT has one element called "Bit" of data-type BOOL[xxx]

I address my BOOL tags as MyTag.Bit[yyy]


Now I can freely use COP or CPS to exchange data from the tag containing the BOOL Array to a DINT tag or Array...

COP MyTag MyDINT[zz] length
COP MyDINT[zz] MyTag length


Notes,

"xxx" above will "snap" to the next highest 32-bit boundary - eg. if you create Bit as BOOL[100], it will go to BOOL[128].

"length" above is the length, in elements of the destination data type - eg. to copy MyTag to a DINT array, length = 4, and to copy the DINT[4] array to MyTag, length = 1


2016-11-22_103147.jpg
 
I stand corrected.
I actually meant to say BOOL[32] in UDT, but typing in a hurry does not help :)

I cannot type in a hurry, definitely a "two-finger" typist, sometimes reduced to one when I get the two confused :ROFLMAO:
 

Similar Topics

Hello all. I have a Danfoss VLT feeding an INT into my CpLX program. I need to concatenate the MSB and LSB for position. I used a COP, making sure...
Replies
10
Views
567
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...
Replies
5
Views
501
I'm having to make an AOI to use with a generic ethernet device because the manufacturer does not provide an AOP. I just want to do a sanity check...
Replies
13
Views
1,152
We're converting a machine's control from CompactLogix to Micro800. It was originally going to be on a Micro850. However, because we've ended up...
Replies
2
Views
1,515
Long time lurker, first time poster.. I've been working with PLCs for a while now and have ran into a head scratcher that I was hoping someone...
Replies
8
Views
2,163
Back
Top Bottom