AB Logix5000 Moving Data

CM3

Member
Join Date
Jul 2015
Location
North Carolina
Posts
11
I'm a Siemens person, and this is one of my first AB programs.
The customer wants everything programmed in Ladder.
I have a lot of data (3 integers worth of bool values) that I am moving from a group of non-concurrent words that I am receiving from the bus. These words break into individual Boolean operators. I know I can do a ladder run to convert each word bit into a local argument, (or use the Boolean operator directly from the word). What I would like to do is define a UDT structure with all of my operators, and then move the words to write into that structure; but I don't know if this is possible in AB.

So far I have looked at using BTD to grab the words and place them - but that does not appear to work for a UDT type for placement. I looked at doing a COP instruction - and this will work for single words - but I am dealing with 3 words. I tried to build an array of word, stack my non-concurrent words into a concurrent format and then COP them into the UDT - but COP didn't like being assigned to the header of the array instead of a direct array address.

Is there a way to do this that I am missing?
 
I think you are on the right track. If your UDT consists of 96 BOOLs you should be able to COP with ARRAY[0] for the Source and the UDT instance name for Dest with Length 1. (Where ARRAY is the name of a DINT[3] array, and ARRAY[0] is the first DINT in the array.)
 
Code:
COP the_array[0] the_udt 1

will COPy the 48 (96?) bits of the_array[0], the_array[1], and the_array[2] to the_udt, assuming the UDT is 3 words long
?
 
Yes, doing it in structured text would work - but customer requires everything in ladder....

In the ladder instruction for COPy I can specify a length, but not a destination location if I keep my UDT defined as individual BOOLS - or perhaps I am not understanding what direction you are pointing me in. If I could specify a destination address with COPy then I could see this working.
 
Yes, doing it in structured text would work - but customer requires everything in ladder....
What he gave you is ladder, just in a text format.

The amount of data copied by a COP instruction is determined by the destination data type. If the destination is a UDT that is 3 DINT long, it will copy 3 DINT worth of data starting at the Source (and then repeat if Length > 1). You don't need to specify an individual member of the UDT unless you only want to copy into part of the UDT.
 
Last edited:
What he gave you is ladder, just in a text format.

The amount of data copied by a COP instruction is determined by the destination data type. If the destination is a UDT that is 3 DINT long, it will copy 3 DINT worth of data starting at the Source (and then repeat if Length > 1)

Oh, right, sorry, I assumed knowledge that had not yet been groked (I am not normative. I am not normative. ... ;) )

That is the mnemonic form for specifying ladder logic in many Allen-Bradley IDEs. If you double-click on the rung number, you should get a text box that contains that mnemonic form for the rung (or blank if the rung is empty).
 
An example copying a structure to an array can be seen here.

P.S. If those source words are being written asynchronously (e.g. they are input channel memory buffers, or written over the network), then you may want use use CPS instead of COP or MOV to move the individual words into the array elements.
 
So if I am reading these directions correct, if I point the copy instruction to the first DINT in the array, and then tell it to copy 48 bits, it will copy all 3 DINT's ?
 
The source needs to be TempWordStack[0]. It won't automatically assume you want to start your copy at the beginning of the array. (And note that if your array wasn't actually 48 bits long, it would still 'work'... but the extra bits would come from somewhere you might not want them to).

Your Length should be 1. The unit of measure for Length is the data type of the destination. Since 'SW' is 48 bits long it will copy 48 bits* with a single iteration.

Or to put it another way, you are telling it to copy '[Length] * [size of SW]' worth of bits

(If you weren't dealing with BOOL then you could directly address the first member with the COP and then adjust the length accordingly, but COP doesn't work directly with BOOLs so you can't)

*It might actually take 64 bits due to how data alignment works, but in this case it doesn't actually matter
 
Interesting; so the copy length should be 1 because the "destination element" is recognized as one array of elements - not the individual 48. Thanks everyone, I really appreciate it!
 
Interesting; so the copy length should be 1 because the "destination element" is recognized as one array of elements - not the individual 48. Thanks everyone, I really appreciate it!
Basically, COP copies 'chunks of data' and it looks at what the destination is to determine what size the chunk should be. A destination of 'Array' will mean 'the whole array'. A destination of 'Array[X]' will mean 'one unit of (whatever data type the array is), starting at position X' (you can then increase the length to fill more of the array).

Note that a UDT need not be as simple as just an array, but if the data in it is non-contiguous and you are copying from something that is this may cause issues.

Now I have four copies of that 861 page manual. You might think about letting people know the nature of your hyperlinks.
If you get a dozen, the next one is free!
 

Similar Topics

Hi Guys and Girls, I'm looking for suggestions, I need to measure how often an analog signal is above a set point and trip if it's above the SP...
Replies
15
Views
4,756
Trying to move a RSLogix5000 key to a key disk and am getting an error 'Cannot Move to Non-Master Disk'. Any help?
Replies
1
Views
5,098
Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
123
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
428
Good day everyone. if you have a logic for 3 pumps (lead/lag/off), would you please email it to me? I really appreciate it!
Replies
7
Views
218
Back
Top Bottom