You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old September 12th, 2018, 01:41 PM   #1
Ce.O
Member
Mexico

Ce.O is offline
 
Join Date: Sep 2018
Location: MEXICO
Posts: 10
Cop

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.
  Reply With Quote
Old September 12th, 2018, 01:47 PM   #2
Ken Roach
Lifetime Supporting Member + Moderator
United States

Ken Roach is offline
 
Ken Roach's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 14,264
Yes. That is exactly how the COP instruction you described will work.
  Reply With Quote
Old September 12th, 2018, 02:06 PM   #3
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 198
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).
  Reply With Quote
Old September 12th, 2018, 04:30 PM   #4
Ce.O
Member
Mexico

Ce.O is offline
 
Join Date: Sep 2018
Location: MEXICO
Posts: 10
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
  Reply With Quote
Old September 12th, 2018, 05:08 PM   #5
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 812
You want to move 8 registers to one register? There isn't much point to that, Only the last one will take effect.
  Reply With Quote
Old September 12th, 2018, 05:54 PM   #6
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,248
Are you trying to move the sum of the values in those registers to N7:20?
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Old September 13th, 2018, 11:47 AM   #7
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 198
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
  Reply With Quote
Old September 13th, 2018, 03:05 PM   #8
Ce.O
Member
Mexico

Ce.O is offline
 
Join Date: Sep 2018
Location: MEXICO
Posts: 10
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.
  Reply With Quote
Old September 13th, 2018, 04:56 PM   #9
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 812
Quote:
After that, I want to divide (n7:8 to n7:15), and save that values in others n7's
Not clear on the DIV. You want to DIV each value from reg 8 to 15 by . . . what?
  Reply With Quote
Old September 14th, 2018, 03:10 AM   #10
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 198
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 by Aardwizz; September 14th, 2018 at 03:19 AM.
  Reply With Quote
Old September 14th, 2018, 12:06 PM   #11
Ce.O
Member
Mexico

Ce.O is offline
 
Join Date: Sep 2018
Location: MEXICO
Posts: 10
I got it, thank you so much Aardwizz and all of you.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Fire Repair Problems Tim Ganz LIVE PLC Questions And Answers 26 April 2nd, 2016 07:40 PM
Modicon Traffic Cop bitmonkey LIVE PLC Questions And Answers 5 December 2nd, 2015 08:33 AM
Question about weird COP instruction behavior SergioB LIVE PLC Questions And Answers 13 December 31st, 2012 10:05 AM
SLC500 COP instruction & scan tborycki LIVE PLC Questions And Answers 7 May 13th, 2010 09:39 AM
Confirmation of COP Instruction in RSLogix 5000 recondaddy LIVE PLC Questions And Answers 5 October 30th, 2007 04:14 PM


All times are GMT -5. The time now is 06:51 AM.


.