JZerb

# and [ ] with COPY commands?

8 posts in this topic

trying to understand, so that i may modify, a section of logic here and ive come across something i have yet to see in my limited time programming.  the COPY commands here with a # and also a [ ] around the integers is what is confusing me.  from what ive read you need to use the # sign in front of a string integer in order to use the COPY command?  any sort of light shed on ths subject would be greatly appreciated. 

Syntax_Questions.jpg

Syntax_Questions_2.jpg

Share this post


Link to post
Share on other sites

The # symbol is how you denote an indexed address. Page 632, Section E-10 in this manual

http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1747-rm001_-en-p.pdf

The brackets denote indirect addressing. Types of addressing are discussed starting on page 601 of the document referenced above

If you can get your head around it (it's not that hard) indexed and indirect addressing can be very useful (or annoying depending on your thoughts on using it)

Share this post


Link to post
Share on other sites

awesome, thanks!  ill have to read up in that pdf this evening and see if i can get my head around what youre saying.

Share this post


Link to post
Share on other sites

Does this work the same way in PLC5? If so, can someone explain why the number in S:24 would change in the status file and I can't find a reference to it in the ladder logic?

Share this post


Link to post
Share on other sites

If it is like the SLC then it is the actual index value used by the system during the execution of the 'file type' instruction. With a length of 10 I would expect it to be left at '9' (assuming no other instructions which have the '#' character were executed between this instruction and the end of the scan.)

Edited by b_carlton

Share this post


Link to post
Share on other sites

I know this is an old thread of mine but im hoping bumping it gets the answer instead of starting a new.  

 

if you have Indexed Addressing being used in a program, for example i see COP and MOV commands with #N or #ST used as sources and destinations.  But when looking at S:24 and seeing 0's for the entire word, what would be the reasoning behind using the # for indexed addressing in the first place since from what Ive read and understand there needs to be an actual value in the Index Register S:24 for it to actually do something.   

Share this post


Link to post
Share on other sites

S:24 is a Status register, something that is part of the legacy PLC-5 and SLC-500; I/O address-based, compared to Logix platforms that are tag-based.

COP is a word-for-word copy in which the user declares how many words to be copied from A to B; limitations on TYPE.

MOV is an element-to-element move; with limitations on SIZE; with open limitations on TYPE.  One can MOV an INT to a FLT; MOV can convert data type (like two instructions in one).

http://www.plctalk.net/qanda/showthread.php?t=24467

Share this post


Link to post
Share on other sites

That i understand, what Im foggy on is the use of # in front of a MOV or COP command within the logic in question.  It was my understanding that in order for the # to mean anything of significance within the logic that the S:24 Status register would need to have a number in it, not just a 0.  I guess what Im trying to say is that to me it seems as if this logic has indexed addressing setup improperly, because in this instance it seems as if its not setup at all. 

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