Cop

Ce.O

Member
Join Date
Sep 2018
Location
MEXICO
Posts
19
Hello.
I'am using these instructions, COP.

I want to know whether is possible use them like this:

COP
source:#n7:0
dest :#n7:8
lenght:8

I want to move this data like this
n7:0----->n7:8
n7:1----->n7:9
n7:2----->n7:10
n7:3----->n7:11
n7:4----->n7:12
n7:5----->n7:13
n7:6----->n7:14
n7:7----->n7:15
Thanks.
 
What you are planning on doing will work with the code that you describe.

A friendly word of advice: It almost inevitably happens that, as the project advances, you discover that you need to store 9 or 10 words of data, not the 8 you planned.

The problem is, you can't use N7:8 and N7:9 to increase your data size easily, as they are being used as your storage registers. Better to give yourself some room to grow, and do your copy as COP (N7:0 N7:20 8). It'll be easier to follow, too, that the register in N7:27 came from N7:7. Doing it your way, the mental math can be confusing (for others, if not yourself).
 
Ok, thanks for the advice. Now I have another problem.
I want to do something like this:
n7:8----->n7:20
n7:9----->n7:20
n7:10----->n7:20
n7:11----->n7:20
n7:12----->n7:20
n7:13----->n7:20
n7:14----->n7:20
n7:15----->n7:20

I don't know whether there's an instruction in RS logix to do that. I want to move the n7's to n7:20 but I don't want to do it with a lot of moves.
Thanks.
I'm learning english, so If sometimes I wrote wrong or you don't understand, please tell me, and I will try to explain better
 
You might want to look at the FAL instruction.
---+----------- FAL --+
| Control: R6:0 |
| Length: 8 |
| Position: 0 |
| Mode: INC |
| Dest: N7:20 |
| Expression: |
| #N7:8 |
+------------------+


What will happen is that while the rung is true, on each scan the next register of N7:x will be moved into N7:20. When you've moved all 8, the R6:0.DN bit will get set.

Like everyone else, I'm wondering WHY you would want to do this. If you were to use the mode ALL, for example, then all 8 values would be moved into N7:20 in the execution of a single step, which would make the first 7 moves useless to the rest of the program. So if you're looking for a scan-by-scan move/copy, then FAL is the way to go.

You can also do some complicated stuff with an FAL. For example, if you're expression was "N7:20 + #N7:8", this would sum all the values of N7:8 through N7:15 and store the value in N7:20. Just be sure to clear N7:20 before the FAL, and watch for math overflow!

Good luck
 
Ok, I'm going to explain what I want to do, may be there is a better way.
Ok, here I go.
First, I have 8 values from n7:0 to n7:7, this is my back up, and I want a copy of each value, so that's why I use a cop.
n7:0----->n7:8
n7:1----->n7:9
n7:2----->n7:10
n7:3----->n7:11
n7:4----->n7:12
n7:5----->n7:13
n7:6----->n7:14
n7:7----->n7:15


After that, I want to divide (n7:8 to n7:15), and save that values in others n7's, and I don't want to divide every value with a lot of "DIV", I want only one "DIV" for each n7, so that's the reason I want to send them to n7:20
DIV
Source A:n7:20
Source B:1000
Dest:n7:21

And finally I want to use a Fifo to save each value in others n7's
FFL
Source:n7:21
Fifo:#n724
Control:r6:3
Length:8
Postion:0

and I have another question, How can I use #F8:0 on fifo? My program marks error, but when I use #n7:0 it works and I don't know why.
Thanks.
 
1) The FAL instruction can do all eight of your divisions in one step. Set Mode to ALL, the Dest to #F8:0 (the '#' is important, it will index the destination as the source indexes) and use the expression #N7:0 / 1000 (assuming that you want to divide each by 1000; you can write more complex equations, and use indexes addresses with those as well.)


2). The FIFO instructions (FFL & FFU) only work on integer(N-type) files. BUT you can use a COP to mimic a FIFO. There are two techniques:

A. COP #F8:1 #F8:0 8. This shifts every register DOWN one place. F8:1 goes to F8:0; F8:2 goes to F8:1; and so on. So you would loose data into F8:8, and watch it migrate down with each execution of the COP.

B. If you have your heart set on moving the data UP through the registers, then you need to use two COPs and an interim register:
COP #F8:0 #F8:20 8
COP #F8:20 #F8:1 8

The first is more "elegant" and requires less memory, the second is somewhat easier to understand

There is a third method, which doesn't shift the data, but instead uses indirect addressing to change the data load point. It's still a FIFO, but a circular one.
 
Last edited:

Similar Topics

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
194
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
635
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
537
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,250
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,563
Back
Top Bottom