S7 Local Variables Explanation

lanester

Member
Join Date
Aug 2010
Location
England
Posts
29
As a relative newbie to Siemens I can not seem to find any documentation that explains the following. In an FB I have the following code (see image).

What i don't understand is how TEMP variable byte "H_Fehl_Stat"'s address is 6.0, yet in the ladder, bits L5.0, L5.1, L5.2 are being used to set data in this byte. Please can someone explain!? I would have thought you'd need to set bits L6.X.

s7code.jpg
 
One possibility is that H_Fehl_Stat used to be at address 5 but someone added a new variable and its address shifted to 6 but they forgot to update the absolute addressed local bools.
 
You are correct, it won't set those bits. That is why direct addressing of the L area is so dangerous.

Most likely it worked before and someone added data before it in the stat area and everything is offset now.

Is it something that is operational at the moment?

EDIT:
Damn... LD beat me to it!!!
 
Last edited:
As a relative newbie to Siemens I can not seem to find any documentation that explains the following. In an FB I have the following code (see image).

What i don't understand is how TEMP variable byte "H_Fehl_Stat"'s address is 6.0, yet in the ladder, bits L5.0, L5.1, L5.2 are being used to set data in this byte. Please can someone explain!? I would have thought you'd need to set bits L6.X.

you do not have to set the Local Bit with -( )- instruction it is done in the declaration table unless you intend to overwrite it with a different instruction.
Note the temp variable status is only working available after the set instruction and you do not have to call it by L#.# just call it by name #NAME
 
Thank you all for your comments and suggestions. This is an extract from a machine not something I have written.

I have since uploaded from the PLC from scratch and this reference still appears 1 byte out. The bits L5.0 etc appear to mapped through to OB_Fehl_Stat. So I am still puzzled.
 

Similar Topics

Hey all, I have an AOI with multiple instances created in my running project. The question i have is: where do Local variables of each instance...
Replies
2
Views
1,102
Hi all one question about Logix5000 and AOI: normally I work with Siemens, and I use FBs with multi-instances Now I need to transpose the...
Replies
8
Views
2,636
I changed a counter in a function block in Simatic S7 program on offline. Then i saved and closed the function block and open the data block...
Replies
1
Views
6,617
Hi folks. I am currently working on a little program that needs to index files in several directories and decide which ones need to be emailed...
Replies
1
Views
5,431
hi, does anyone have information on accessing loal variables and linking them to their respective addresses, for example, if i have a local...
Replies
3
Views
1,680
Back
Top Bottom