Easy peasy with Pointers in S7 (SBS)

mjoha266

Member
Join Date
Jan 2008
Location
Gothenburg
Posts
34
Hello!

I just have a little problem. Well actually it's not a problem with S7 it's more me that is the problem...

To a FC i have a input: InP [Pointer]
and right now I want to do the easiest thing in the world... just look at the variable at that position.
This is my try:

L P##InP
LAR1

A [AR1,P#0.0]
= #IsSet

So in to this block I send a Pointer created with "datablock".varname [a bool] and I just want a true at IsSet if the variable is true... How hard can it be???

/Thanks!
 
You have a pointer to a pointer so in this case you need the following. (iDB is a temp int)

Code:
	  L	 P##pInp
	  LAR1  
	  L	 W [AR1,P#0.0]
	  T	 #iDb
	  OPN   DB [#iDb]
	  L	 D [AR1,P#2.0]
	  LAR1  
	  A	  [AR1,P#0.0]
	  =	 #Isset
 
No it does not load from a data block.
Pointers occupy 6 words of memory. All FC parameters occupy 4 words - so you cannot pass a pointer to an FC, instead, you pass a pointer to a pointer using the local data area of the calling block....

You did say easy peasy didn't you ?
 
Same same but diffrent. I think this will work

L P##InP //Declare as bool in instead of pointer
LAR1
A [AR1,P#0.0]
= #IsSet
 

Similar Topics

See picture. I want to add a rung (magenta) into the existing code. Can't figure out how to do this. I select a -||- , right? When I drag/drop...
Replies
21
Views
1,791
Hi All, On my site, the standard template for storing recipes in the PLC is to create a tag called PartRecipe which is an 2D array - for example...
Replies
4
Views
1,470
I would like to do change a kinetix drive, so i believe i just have to put the IP address in the new kinetix and just connect right? Do I need to...
Replies
1
Views
1,196
Hey all, I am trying to check in logix designer in emulator and I need to check the hmi alarms by toggling bits to activate an alarm . But...
Replies
4
Views
2,066
Good afternoon guys, I have a basic question on the bubble level in the picture attached. This is probably really easy, but I don't get it, haha...
Replies
11
Views
3,347
Back
Top Bottom