jk_

PLC5 Conversion Indirect Addressing: #N[N187:4]:[N187:5]

4 posts in this topic

Can anyone explain to me what this would mean in a COP instruction?

Source: #N[N187:4]:[N187:5]

Dest: #N[N187:1]:0

Length: 20

I am doing a PLC5 conversion to rslogix5000 and some (most) of it has been a nightmare -.-

Share this post


Link to post
Share on other sites

Posted (edited)

If you already know what N files and COP instructions do, skip the bullet points below:

  • In the old PLC5 and SLC processors, the N file is where integers (numeric values) are stored.
  • A COP instruction is supposed to move an array of data from a source file location to destination file location, for a specific length of the array.
  • When the COP instruction goes true, the data from the Source word, plus however many contiguous words after the Source word (as designated by the Length), would be move to the Destination word, plus the specified Length contiguous words after the Destination word. 
  • If my Source is N7:4, the Destination is N7:20, and the Length is 5..... the values of N7:4, 5, 6, 7, & 8 would be copied to N7:20, 21, 22, 23, & 24.

It appears as though the programmer has created a file designated "N187", with at least six words of data (N187:0 through N187:5) and is moving data between the words within that file. I'm a bit stumped by this because there can't be a length of 20 between words of data that are less than five spaces apart within the file. 

When I created a new RS5 project and typed those values in the COP, I got warnings on both the Source and Destination within the instruction saying the file number doesn't point to the correct file type. However, warnings will download and sometimes we deliberately have code that create them (like duplicate destructive bits), so that by itself doesn't mean a lot. Frankly, it looks like there's an indirect addressing trick going on here that I'm not familiar with. 

Assuming the syntax you've posted is exactly as written in your project and therefore an acceptable expression, I can't wait for someone who knows more about it to explain it to us.

Edited by ElectronGuru

Share this post


Link to post
Share on other sites

/*

Source: #N[N187:4]:[N187:5]

Dest: #N[N187:1]:0

Length: 20 */

 

I'm not a PLC5 guy, and I never really needed or desired to use indirect addressing,  but aren't N187; N187:5; N187:1 pointers for indirect addresses?

Roughly, If N187:4=0, N187:5 = 1, N187:1 = 2

then the copy command would be

Copy N:0 thru N:1 to N:2 (or some version of that)

 

 

Share this post


Link to post
Share on other sites

OK Guys time for the "old fart" to weigh in.

with a COP like this :

Source: #N[N187:4]:[N187:5]

Dest: #N[N187:1]:0

Length: 20 */

 

If N187:4 is 17 and N187:5 is 0 and N187:1 is 27 

The Command becomes COP

Source N17:0

Destination N27:0

Length 20. or N17:0 thru N17:19 copied to N27:0 thru N27:19

If N187:4 is 17 and N187:5 is 10 and N187:1 is 27 

The Command becomes COP

Source N17:10

Destination N27:0

Length 20. or N17:10 thru N17:29 copied to N27:0 thru N27:19

 

This assumes that everything exists,

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now