Can any Step7 guys help an old AB guy out?

IAA

Member
Join Date
Sep 2007
Location
Michigan
Posts
34
I have been working on Step 7 PLC that has me scratching what little hair I have left.

It looks like there are (local?) variables named #F_LS and #R_LS and one has to be on and the other off to make the output turn on.

[ ]--------[/]--------------( )
#F_LS #R_LS

How in the world do I find out what the #F_LS is representing? When the machine clamps I can see the #F_LS go high but I don't know what input is making it work.

Are these declared somewhere in the FB or the DB? I can see them mentioned at the top of the FB and I can see then listed in the DB but I cant figure out how they are tied to the real world.
 
Where in the declaration section are they listed? Are they listed in the In or In/Out sections? If not there would need to be logic in the FB prior to their use that sets then to one state or the other.

My guess is they are declared as In's and they are passed at the FB call.

Keith
 
They are in the IN section.

If they are declared as INs, then the FB is being called somewhere in the PLC code. Wherever that is, values are being passed into F_LS and R_LS.

If you look in the reference data (or Program Info, if using Portal), then you can view the call structure of the code, which declares which code is called from where.
 
In simple AB terms a FB is approximately equivalent to an AOI which has internal variables that are retained between scans (Hence the data block associated with the FB)

A FC is approximately equivalent to an AOI which does not have internal variables that are retained between scans (temporary variables with undefined starting points)

An OB is sort of like a routine, and a data block is a user defined data type, either formally or informally. (TIA allows both user defined DB types and DBs consisting of tags entered by the programmer, with no formal structure)

As for your variables:


A # indicates a local variable, these can be of the following types (not all are available all the time):

IN : input to the function (read from the top left hand side of the function call down)

OUT : output of the function. (read from the top right hand side of the function call down) This will always overwrite the tag on the output. Try not to have #V1_Open and a global "V1_Open" or the typo will really ruin your day.

INOUT : input/output tag, this is read at the start of the function call, and only gets changed if the logic puts something there. (read from the left hand side, and starts just under the IN section. It is not obvious when the IN section changes to INOUT on the function call)

STATIC : These are internal variables only, and are retained between each function call using the same data block. You can actually read these from a HMI if they are set to be visible from the HMI. You can also retain these between power cycles of the PLC.

TEMP : Temporary variables, the starting values could be absolutely anything. You should initialise these before using them.

CONSTANT : Lovely constants. These are blue and mean that you get to name that 3.1415926 you multiplied the equation by to something logical, like Pi.

That should give you some indication of the general layout, and make life a little easier. Just remember to shout at whoever though #F_LS is a good variable name. At least tell me there are comments.
 
Only for Simatic Manager, not Portal (cuz we don't use it yet):

In the LAD/FBD/STL-editor, you should have the Overview pane on the left side. If you do not, press CTRL+k.
It has 2 tabs located at the bottom, one of which is named "Call structure". This is a nice feature.
Open the FB, now check the Call structure to see which block calls it. Double click on said block to open it. Find the FB call and you will see what is linked to the relevant IN-/OUT-parameters.

If said FB is called several times, with different parameters, it makes things more ..... interesting. :D
 
Thanks for the explanation and directions.

I am getting closer I hope. I found were the FB gets called from and I have

F_LS= "Fixture_B1_F_Sensor"
B_LS= "Fixture_B1_R_Sensor"

or if I display the tags I see

F_LS= M55.7
R_LS= M56.0

My guess is the M55.7 and M56.0 are for an Input 7 and Input 0 to an Input card but that is purely a guess.

Can I search for M55.7 and M56.0?

Any other insight is greatly appreciated.
 
M55.7 and M56.0 are internal bits (merkers).
Think of it as a B type in AB.
Yes you can search for the above bits.
I think ALT + CTLR + R
will bring up the cross ref window (going by memory here).
 
M is for merkers. Volatile memory that, unless otherwise configured, gets reset on power down.
Right click on it in the Editor, then select Go To > Location (or select it and press Ctrl+Alt+Q)
It'll produce a x-ref list of where that merker is used. Double clicking on an entry in that list will open the relevant block in the relevant network. If used multiple times in the same network, it'll go to the first instance it encounters.
You can do this for IO, DB's, merkers, counter, timers,, FC's, FB's, etc.

In the x-ref list, you have a column with "Details".
It shows: NW xx /yy
Where xx = network number
And yy it's usage.
Which can be:
S = Set (OTL)
R = Reset (OTU)
'=' = OTE
A(N) = Logical AND(NOT)
O(N) = Logical OR(NOT)

It is also wise to check the box at the bottom labeled: Overlapping access to memory area.
M 56.0 can be referenced as part of:
MB 56 (Merker byte (8-bits) starting at M56.0)
MW 55/56 (Merker word (16-bits) starting at M55.0 or M56.0)
MD 53/54/55/56 (merker doubleword (32-bits) starting at M53.0/M54.0/M55.0/M56.0)

This holds true for most S7 addressing. I (inputs), Q (outputs), M (merkers), DBxx.DBX (Datablocks).

You can for instance use a Load/Transfer of MB20 to MB21 to copy the status of 8 bits. And use M21.0 - M21.7 in the logic. If you do a simple x-ref, you'll never notice where the bits get set.
RSLogix 5k does this automatically in its x-ref. In S7 you have to check that little checkbox.
 
Thanks for the explanation and directions.

I am getting closer I hope. I found were the FB gets called from and I have

F_LS= "Fixture_B1_F_Sensor"
B_LS= "Fixture_B1_R_Sensor"

or if I display the tags I see

F_LS= M55.7
R_LS= M56.0

My guess is the M55.7 and M56.0 are for an Input 7 and Input 0 to an Input card but that is purely a guess.

Can I search for M55.7 and M56.0?

Any other insight is greatly appreciated.


For items that are global in scope (M55.5 or DB1.DBX1.1)
To search for a contact you can right click on it and select goto location. Or click on it and use the hot keys ctrl+alt+Q


Local items (ins / stats / temps... items that start with #)
goto location does not work but I believe there is a go forward and go backwards (operates very much like a 'find' in a word document) that will find the instances of it in that FB or FC. I believe the hotkeys for these are ctrl+shift+F and ctrl+shift+B (forwards and backwards)
 
Shot in the dark but could you have some Last State logic in there somewhere to give a one shot signal, judging by those names.

Worth have a dig around with that in mind.
 
Thank you everyone for the answers and input. It was a good exercise on learning a little bit about STEP 7 software.

I was able to navigate to my inputs that needed to be turned on and now I just have to wait for the fault to happen again.
 
Thank you everyone for the answers and input. It was a good exercise on learning a little bit about STEP 7 software.

I was able to navigate to my inputs that needed to be turned on and now I just have to wait for the fault to happen again.

Good luck! I swear, sometimes the hardest part of troubleshooting is just getting the system to do it again while I'm watching. I can't count how many times I've had to tell some plant manager looking for a status update "I'm sorry sir, but the system has worked flawlessly all day".
 

Similar Topics

I am doing some S7 programming. This is the first in 6 years. I got the Profibus DP interface to the motion controller working. Look at what...
Replies
126
Views
48,190
This is the first time I am working with Simatic Manager Step7 as I started my siemens journey with TIA which is pretty easy and do a lot of stuff...
Replies
3
Views
144
When you download a DB, the values get overwritten by what is in the "actual" column in offline DB. Does this happen at the start of the PLC...
Replies
6
Views
142
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
128
Hi all, I am trying to convert RSLogix 5000 program to Step7. I need to bit shift left my array of double integers for tracking the product on...
Replies
2
Views
520
Back
Top Bottom