ControlLogix COP

gitargr8

Member
Join Date
Apr 2009
Location
Long Beach
Posts
17
I have a boolean array, 512 bits long, and I want to set all bits to 0. I was thinking of using the COP instruction to copy 0 to every bit, but this instruction doesn't support using bits in the source/dest. Is there any "easy" way to do this other than using a for/next to unlatch every bit in the array?

Thanks,
~Ryan
 
The reason it's a boolean array is because each bit in the array corresponds to another array. If I used a DINT array, then these numbers would not match up anymore.
 
I believe that you are going to need to use unlatches. You may be able to use a counter and indirect address to step through the whole array instead of having 512 rungs. You would need to put the accumulative value of the counter(.acc) into a DINT to use in the indirect address.

The problem will be that you could run into is which rung will win in setting the state of the bool.
 
Yea, I just used a label and jump and incremented an index to the size of the array, and used this index to unlatch the bit. I was just curious if there was a cleaner way of doing this.
 
You may need to leave some more info on how the two arrays correspond, but if you just need the indexes to match then this might brute force it. You could make your array an array of int or sint and just address one bit when you make use of it.

array[x].1

where .1 is your bit designation. Then you could use the COP to reset the whole sint or int word and achieve reseting the one bit out of each word you actually care about.

Got memory?

Russell
 
This looked alright in my head. You may need to tweak with it. I think the rungs would have to be in that order so that zero happens before the counter counts.

Unlatch.jpg
 
I have a boolean array, 512 bits long, and I want to set all bits to 0. I was thinking of using the COP instruction to copy 0 to every bit, but this instruction doesn't support using bits in the source/dest. Is there any "easy" way to do this other than using a for/next to unlatch every bit in the array?

Thanks,
~Ryan
If you create a UDT to hold the boolean array, then you can use a single FLL instruction to clear it.
The UDT would have a single array member, e.g. no[512]
Create a tag of the new UDT type e.g. bit
Program references to the bools would be like: bit.no[5]
To clear all the bools: FLL,0,bit,1
You can also copy into other tags e.g. COP,bit,dint_tag[0],16
 
@dmroeder: I was referring to the post that suggested I use and array of SINTs and use only one bit

@GeoffC: It looks like XOR in ControlLogix only supports SINT, INT, and DINT data types. I can use BXOR in the function block editor, but this will only work on individual elements, which would require an iteration.
 

Similar Topics

So this is a weird issue and its really a stretch to guess what is happening. We have what is known as a lug chain, which is basically a...
Replies
13
Views
2,239
Why does the controllogix redundancy modules use a single mode fiber vs multimode fiber?
Replies
1
Views
78
Hello, I have two 16 point input cards and 1 16 point output card showing module faulted on my IO tree in Logix Designer. The fault code is...
Replies
7
Views
213
Hello, My associate and I are trying to sync up two ControlLogix racks (7-slot chassis) with identical modules. We are able to see the secondary...
Replies
4
Views
190
Trying to setup a message read via Ethernet. I have the path setup as 1, 1, 2, 192.168.66.10 I get an error code 1, ext err 315. I am beating...
Replies
9
Views
229
Back
Top Bottom