Step 7 Using a variable/tag in place of a value argument.

timryder

Member
Join Date
Feb 2007
Location
Macomb MI
Posts
176
So I know that in RSLogix 5000 you can use a tag in place of a static number in an argument of any instruction. For example... If I wanted to look at a specific address within an array in 5000, I would enter the following..

ExampleArray[##].bit

but I know that I could replace the # with any integer tag I wanted to

ExampleArray[PointerINT].0 and RSLogix would be happy with that.

Does anyone know if you can do the same in Step 7? If so How?
What I'm trying to do is when moving a block of data (BLKMOV) I don't want to specify the amount of BYTE data with a static number but instead use a variable.

Right now, my value for SRCBLK argument is
DB100.DBX0.0 BYTE 128.

Instead what I'd like to do is replace the argument for BYTE 128 with something like....

DB100.DBX0.0 BYTE #StringLen o_O

The reason I would like to do this is because I am talking Profinet to a Keyence Laser Marker and one of the commands I send the laser, it will respond with the data which was marked in one of their DataMatrix code blocks. The data length will be variable and in another word address it gives me the length of the string it sent. So I'd like to do a BLKMOV command and specify the exact number of characters which came over in the request so I'm not picking up any erroneous data from a previous request. Yes I know that I can blank out the data array first with the BLKFLL command but sometimes I just don't want to.

Does anyone know if how this is possible?

Thanks:site:
 
Last edited:
Whoops - Lare was a little faster!

You should be able to do this with an ANY pointer.
On the Siemens support site take a look at article: Entry ID: 21946854
It might help.
 
For the record, in TIA Portal with a 1200/1500, array based indirect addressing is possible (Array[#index]). You can also use Move_Block instead of BLKMOV, which has a count input, for the 2nd half of your question. This all works from ladder.

I mention this, because I always hated having to leave LAD to do a task. The old stuff makes you jump through hoops, but the newer system really lets you do what you want to.
 
Ugh!!!!!!!

:mad:

Please can someone explain to me why this won't work? Also how can I (in LADDER) get this to work?
I have Step 7 v5.5 SP4

:Frustrated: Thanks.... Tim

DBPointerFail.jpg
 
:mad:

Please can someone explain to me why this won't work? Also how can I (in LADDER) get this to work?
I have Step 7 v5.5 SP4

:Frustrated: Thanks.... Tim

Sorry, I guess none of us were explicit in our answers above. You can't do it in ladder with an S7300.

You CAN do it in STL or SCL in a 300, or you can upgrade to the newer 1500 series that does support indirect addressing in LAD.
 
You need to construct any pointer variable for BLKMOV, S7 5.x ladder don't like of your statement

You can also do this with STL or SCL coding and use it on ladder if you put STL inside FC or FB block.
 
I do not know anything about STL or SCL or SFC and haven't the time unfortunately on this project to learn them in order to use it for my needs...

:SIGH:
 
Look this thread:

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

L D[AR2,P#0.0]'s example LPP.zip does pretty much what you want.
With little modify you can make selector to select from 10 variables

Then repeat it 10 times and last copy with BLKMOV.

another way is to copy whole array (use UDT 1.100 array for input) then inside bblock select correct array with SCL code.
 
Thanks very much, but I will not be using it.
I do not think it is very wise to load something into your program when you do not understand what it is doing or how.

I will just have to create many rungs of logic with multiple case scenarios for what I need to do.
 
it is only 100 rungs ;)


If you want go SCL route, then it would be something like this. Basically it is same what you tryed type directly to ladder and nothing complicated.

Note that on scl code selector is limited from 1 to 10. This only so that indirect addressing won't direct to address range which don't exist and PLC would go to stop state.

recipe_selector.jpg vat_table.jpg udt_data_types.jpg
 

Attachments

  • recipe_scl.txt
    452 bytes · Views: 8
Last edited:
I don't think I have the ability to create a File with language FCL.

When I create a new Function and call it FC6000, I copy the code from the text file and paste it into the function I get all red text.
 
It is maybe so. SCL is optional program package to S7 (S7 Professional) and needs own license.

SCL code is not maded same way than ladder or FBD. SCL is maded on sources folder and compiled. After that blocks are on program blocks folder.

SCL can be viewed on STL also, but with that language it is usually hard to read. (SCL is converted to STL automatically behind)
 
Last edited:
I'll just write lots of comparison rungs in LAD... i do not have SCL for certain and I do not wish to re-write the great example you've given me in STL.

Thanks anyway
 

Similar Topics

How do I use a variable as an index for an array? I can't seem to do it. I have tried L variable T "P1_DATA_LOG".DATA[#index] // array of...
Replies
9
Views
8,732
I have a basic understanding of truth tables and the addresses. My issue is that for every letter that I have to make, I need a truth table that...
Replies
12
Views
1,444
I have for the longest time avoided using the S7-1500 because everyone warned me that TIA portal was a stinking pile of garbage to be avoided at...
Replies
25
Views
12,173
Good Afternoon , I have a project that I am beginning , that I will be using 3) PowerFlex 525's drives. I took notice of the StepLogic feature...
Replies
1
Views
3,916
Dear Experts. I have one project using HMI Ktp 1500 comfort and S7-300 CPU 315-2DP. The HMI KTP is using Software TIA porttal for programming, and...
Replies
2
Views
2,032
Back
Top Bottom