Control Logix Mov/Cop/Fll instruction

Join Date
Jul 2007
Location
Kiruna
Posts
600
Hi Guys,

Nice easy one for you...I have an array of 150 Analog Inputs. Is there an instruction I can use to move a value into a member of each Analog instance?? For example I have a global setpoint so when an operator selects a global Hi Hi Setpoint I move a single value into CT[x].AlarmHH_SP?

Hope this is clear what im trying to achieve. I can write a loop to do this but I'm sure you guys have a neater way.

Thanks
 
Not sure I follow....Do you have one value that you want to move to 150 places, or 150 values to move to another 150 places? For the former, FLL, for the latter, COP.
 
The File Fill (FLL) command should do it. You could also move the value into the first index MyTag[0] and then do a COP MyTag[0] MyTag[1] 149.
 
If I understand the question right you want to move a specific value into a specific member of 150 different structures.

A COP or FLL won't do this for you as those both work on a continuous block of data, which you don't have. Look into the FAL instruction. This allows you to enter an expression for the destination, allowing you to point the destination where you want it to go. By using the .POS element of the FAL control tag you have alot of flexibility in where the data ends up. However, this still requires that the structures be in an array.

If the structures are in several groups you could use several FAL instructions. If you can live with this taking several scans to complete you can also do the indirection on your own and bump a pointer each scan.

Keith
 
From your OP it looks to me that you have an array of a UDT which is 150 long. This UDT contains a number of elements one of which is this ".AlarmHH_SP". You want to write a single value to all .AlarmHH_SPs for the entire array and leave all other elements of the UDT alone. If all this is true, none of the instructions you listed will work (MOV, COP, FLL).

The operation you want to perform is an ideal candidate for the FAL instruction.

"The FAL instruction performs the same operations on arrays as the CPT instruction performs on elements." This is from RS5000 instruction help on FAL.

FAL.GIF


Each time this rung is scanned the SP_LoadCtl.POS will increment by one thus placing the value for SP_LoadValue into a new CT[x].AlarmHH_SP. The FAL has 2 modes you can selet (INC or ALL). INC will perform the above on only one array element on each scan. ALL will perform the above on all array elements on each scan. If you don't need all the values loaded in a timley manner and are using a complicated expression, I would suggest INC (less scantime required), otherwise set it to ALL. For the simple expression used in this FAL, there's probably not much difference in scantime between INC and ALL, just use ALL.
 
Keith said:
A COP or FLL won't do this for you as those both work on a continuous block of data
FLL will put one source into multiple locations in the platforms I am familiar with.

I can't say for sure if controllogix is different but I would be highly surprised if it was...Keith are you sure about that statement? The contiguous part is the key, if it is an array, then it would work, if it is a member of a UDT I dunno...

EDIT: Nevermind, I think the format of his value gives it away. That is a UDT, right?

OP said:
CT[x].AlarmHH_SP

PEC
 
Last edited:
Thanks

Thanks GMferg. That is exactly what I am looking for. I will try first thing at work tomorrow. Thanks a bunch. Knew there had to be a nice way of doing it

gmferg said:
From your OP it looks to me that you have an array of a UDT which is 150 long. This UDT contains a number of elements one of which is this ".AlarmHH_SP". You want to write a single value to all .AlarmHH_SPs for the entire array and leave all other elements of the UDT alone. If all this is true, none of the instructions you listed will work (MOV, COP, FLL).

The operation you want to perform is an ideal candidate for the FAL instruction.

"The FAL instruction performs the same operations on arrays as the CPT instruction performs on elements." This is from RS5000 instruction help on FAL.

FAL.GIF


Each time this rung is scanned the SP_LoadCtl.POS will increment by one thus placing the value for SP_LoadValue into a new CT[x].AlarmHH_SP. The FAL has 2 modes you can selet (INC or ALL). INC will perform the above on only one array element on each scan. ALL will perform the above on all array elements on each scan. If you don't need all the values loaded in a timley manner and are using a complicated expression, I would suggest INC (less scantime required), otherwise set it to ALL. For the simple expression used in this FAL, there's probably not much difference in scantime between INC and ALL, just use ALL.
 
"The FLL instruction operates on contiguous data memory." This is from RS5000 instruction help on FLL.

OP is using array of UDT. FLL will fill all elements of UDT thru array until length is satisfied. If UDT contains 10 elements, a FLL on this array with length of 150 will fill all 10 UDT elements for first 15 array elements.
 
Ok, tested and works fine. Now another question. Is it OK for me to perform 8 FAL instructions (ALL) in a single scan? My scan time increases by 2ms but thats not a problem for me. Whats your thoughts on this?

PLease see below:
 
Yes, you can do all 8 in a single scan, if not adversely affecting your scan time. My preference personally, unless it's absolutely critical, is to offset heavy computations, and do one every scan, incrementing a counter to advance to the next on the next scan etc.

Another thing is, do you NEED to do this every scan, or only when the single value input changes? If so, then compare your single input value to the last one in your array. Only update the array if they are different.
 
Is the AlarmHH_SP going to be changing often? Instead of executing the FAL every scan execute it only when the value changes. You could also put it in a periodic task instead of the continuous task.
 

Similar Topics

Hello, I was wondering what would be the best way to transfer only the first 16 bits of a dint to a 16 bit int data type? Controller: Control...
Replies
16
Views
17,236
I am having trouble with getting no control of my analog output signal. I am using the SCL function block to control my analog output. The logic...
Replies
11
Views
257
hi all, i have a plc i need to get info from for a site im working on: I have a 1764 Micro Logix 1500 LSP Series C (See Attached Image) im...
Replies
2
Views
381
I currently have a weird issue involving Ethernet IP communication between a ABB CI873 (EthernetIP Module) and a 1756-L83ES. The Layout is as...
Replies
8
Views
761
Possible for two processors in same rack to have separate motion groups across a single Kinetix Rack using a single EN3TR? One 6500/5700 rack, 8...
Replies
1
Views
426
Back
Top Bottom