Siemens Step7 pointer

..and here is the call with the test data ariving in the array in the DB. Coding assumes your array is 1 based.

array1.jpg
 
@L_D
I think that function is written in SCL isn't it? i don't have that language available in the package I'm using.

@Jesper_MP
I have entered the code you gave as a test but it is throwing up a syntax error as below

Step7_PointerBuild2.png
 
@L_D
I think that function is written in SCL isn't it? i don't have that language available in the package I'm using.


No, it is written in STL. You import the code into your sources folder and compile it to generate the block - renumber it if it clashes with an FC you already have.
 
@L_D

Thanks for your replies, i appreciate the help but I require the pointer of 1 in the statement below to be variable otherwise i can just write directly to the element anyway.

"Report_Data_Complete".Blender_1_Stage_Data[1].Start_Time
 
The only thing I'm not quite understanding is the FirstArrayElement and SecondArrayElement variables. If the pointer is set at 3, why does the function require those direct addresses?

Does it break it down and replace the pointer in the statement then copy to that location?
 
It uses the first and second elements to calculate the size of the array element.


Of course, you could remove that and hard code it inside the FC but then it would only work for that particular array with the declared structure at that time.
 
Last edited:
Many thanks for your help. The solution your provided works, is there a way to make the block accept multiple types of data?

eg.

DataToWrite : INT or DINT or REAL;
 
Yes :)


Do you want to write to different entries in the same array of structures, or an entirely different array of structures?
 
Last edited:
FC8 is a new block that allows to you write to any elementary data type to your array entry - example calls included in OB1
 
I dont know about anybody else on here, but I have to say that I am in awe of L D[AR2,P#0.0] (again). I mean the member, not the instruction.
I for one, am not worthy.


He has a very particular set of skills. Skills he has acquired over a very long career.


v1.bjszMjI3MDk7ajsxODU0MzsxMjAwOzMwNzI7MjMwNA
 
Thank you very much to L D[AR2,P#0.0]. I really appreciate the help and bearing with me. I haven't really delved into step7 before which is fairly obvious but with your help i understand more how the pointers work.

🍺
 
Thank you very much to L D[AR2,P#0.0]. I really appreciate the help and bearing with me. I haven't really delved into step7 before which is fairly obvious but with your help i understand more how the pointers work.

🍺


In your defense, I've met people who have been doing Siemens for years who have never done anything in STL at all, and especially not pointers. Usually they're specifically avoiding it.



It's definitely an advanced skill. Good on you for wanting to learn.
 

Similar Topics

I have a word in some DB which I want to load to AR1 and use as a pointer. In order to do this I need to write L DBxy.DBW xy SLD 3 LAR1 I...
Replies
3
Views
537
Hello! Is it possible to copy pointer's pointing address to any variable at Siemens step7? I mean I have pointer address to db block with...
Replies
14
Views
15,548
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
146
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
Hi, I received a Step7 Backup from my client and tried opening this backup but it won't open as there seems to be files missing from the backup...
Replies
11
Views
3,018
Back
Top Bottom