COP command in RSLogix

godfrey

Member
Join Date
Apr 2002
Location
Charlotte, NC
Posts
412
I want to write presets to 14 contiguously addressed timers. I'm not sure if this command will work. The registers holding the presets start in N7:71 and are contiguous but the presets are all different values. I don't want to write to the accumulators or status bits.
When I compile, an error "Address must be specified to the element level" is reported. I could write 14 different MOV statements but I am looking for a shorter way. Comments?
 
You did not mention PLC-5 or SLC-500. If using a PLC-5 then use the FAL instruction instead. Unfortunately the SLC does not have the FAL.

Your destination would be the same, just add a "#" without the quotes ahead of it.

The expression would be the source from your move. Also with a "#" ahead of it. Use All mode.

You must include the "#" in the FAL. The COP adds it for you but the FAL will not.

OG
 
I am using a SLC-5/04. I have used the # infront of my source and destination. I have typed in my source as #N7:71 and my destination as #T4:101.PRE. If I change it to #T4:101 without the .PRE, then the compile goes through OK. With #T4:101 without the .PRE, will it write to the preset of 14 contiguous timers leaving the accumulators and status bits alone? I won't be able to download and test this for about a week.
 
While I can't test this right now, I bet that would fail, writing over the information you mentioned. You're probably going to have to manufacture a pseudo For/Next loop using MOV's with indirect addressing, incrementing your source offset by 1 and the destination by 3 each time through the loop.
 
Something along these lines:

I've run similar "pseudo For/Next loop's" like this before.


Of course, this logic will take 14 scans to complete, which, depending on the application, might not hurt.

If you really needed it to transfer all of the timer presets in 1 scan, you could use a JMP and LBL.

timer.gif
 
Last edited:
I don't know of any A-B instruction that will accomplish the task. I think COP, FAL and such functions will not go to the PRE. element level. If this is the only case that you will need to do such a function the easiest and most logical solution is to have fourteen MOV instructions. I understand your reason for wanting a simple, one instruction, solution but if it isn't available then use the MOV, its not that big of a deal. There is no reason to do some off-the-wall programming just to be different, keep it simple for the next guy, who may not be as smart as you.

Roger
 
Last edited:
You like my "off the wall" style?

rogerhollingsworth said:
There is no reason to do some off-the-wall programming just to be different, keep it simple for the next guy, who may not be as smart as you.

I posted this sample because bernie_carlton suggested it as another option. The application where I used this had about 140 floats that I had to convert from IN to MM In a Spanish built machine.

I agree that with only 14, best would be to MOV individually, but there's nothing wrong with exploring the possibilities.
 
93LT1, I have used the FAL instruction in the PLC5 to copy a group of timer accumulators to a file, but have never tried it with an SLC 500. The logic works very well. The only thing I would add is a first scan bit on rung 3 to set the initial values of N7:0 and N7:1, otherwise the first time around will not work.

first_pass.jpg
 
Kim Gold said:
93LT1, I have used the FAL instruction in the PLC5 to copy a group of timer accumulators to a file, but have never tried it with an SLC 500.


FAL is not available in SLC500.


The only thing I would add is a first scan bit on rung 3 to set the initial values of N7:0 and N7:1, otherwise the first time around will not work.

I always miss something when I try throwing something together quickly like that, thanks...
 
How about


Update timers Cop
|---] [--------------Source N7:71--|
| Dest N10:0 |
| Length 14 |
| |
| |
| Ton |
|--------------------Timer T4:101---|
| Time Base 1.0 |
| Preset N10:0 |
| Accum 0 |





And change all timer preset's to the N10: range

Jezz
 
That would be too easy...

Jezz said:
How about

Update timers Cop
|---] [--------------Source N7:71--|
| Dest N10:0 |
| Length 14 |
| |
| |
| Ton |
|--------------------Timer T4:101---|
| Time Base 1.0 |
| Preset N10:0 |
| Accum 0 |


And change all timer preset's to the N10: range

That would be great, If it were possible. Timer presets have to be a constant; cannot be variables.

ton_error.gif
 
Last edited:
....I understand your reason for wanting a simple, one instruction, solution but if it isn't available then use the MOV, its not that big of a deal. There is no reason to do some off-the-wall programming just to be different, keep it simple for the next guy, who may not be as smart as you.

Roger

Roger, you wrote whole the truth !

Seppo
 
That would be great, If it were possible. Timer presets have to be a constant; cannot be variables.

šŸ™ƒ

I knew that .... [rainbow]I think my mind is going ,these early shifts are not good for me the human body is not designed to be working at 6am [/rainbow].................. zzzzz
 
Ain't that the truth...

Jezz said:
[rainbow]I think my mind is going ,these early shifts are not good for me the human body is not designed to be working at 6am [/rainbow]

I think that should be a law. No one works before 8AM... :D
 

Similar Topics

hi, I have a machine with 2 QR code readers, reading simultaneously, and i am decoding the ascii data from them into DINT for simple label to...
Replies
3
Views
1,453
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,238
I am trying to copy an array of real numbers into a UDT with a real data type element. I have attached a snip below showing my COP instruction...
Replies
4
Views
197
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
637
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
543
Back
Top Bottom