S7 reading data array using pointer L P##......

baselch0

Member
Join Date
Jul 2010
Location
Basel
Posts
27
Hi all.......

someone knows if is possible in S7, using the indirect adressing by means of a pointer L P## to read a data struct defined as Array of ten words of INT??

Thanks in advance
 
More information required. For example is the array passed as a parameters to an FC, what is the destination of the values you have read ?
 
Here's some example processing. You can pass the array to an FC as an array (the size/type must match) or by pointer - the processing inside the FC is the same as arrays are actually passed by pointer as well.
 
I dont' know if is possible, but I'd like read in local variable STAT a data STRUCT call eg.: ALPHA.
This struct contains simple variables [BOOL,BYTE,STRING,INT etc. etc.]and also anothers STRUCT call eg.: BRAVO.
The struct BRAVO contains a data DINT call CHARLIE and DATA ARRAY [0..10] of INT call DELTA.

Well, If try to do

L P##ALPHA.BRAVO.CHARLIE there isn't problem

but if try

L P##ALPHA.BRAVO.DELTA the command is not accepted.

I know If define the pointer with the starting address of the STRUCT ALPHA and ADD the offset of the variables there isn't problem.

But for me in this way loses completely the advantages of use the data STRUCT.
 
As you have found out you cannot load a pointer to an element of a structure. You have to write an FC that you pass a pointer to the element of the strucure and the FC extracts the area pointer for you. See the FB in the example attached.
 

Similar Topics

Hello! New to the forum and new to PLCs in general. We have an ABB AC500 PLC (circa 2012?) and we are using CoDeSys (version 2.something). We're...
Replies
0
Views
615
Hello Ken Roach, Thank you for your quick reply , As informed earlier i want to read P&F Sensor data on Micrologic 1400 series B using MSG...
Replies
17
Views
5,732
Anyone experience of working with these modules and interrogating status of an I/O port? The modules can throw up a red LED indicator to say an...
Replies
0
Views
1,068
Hello, I have a Micro850 PLC that has 5 2080-IF4 plug-in modules attached. Each of these modules are programmed to read 4-20 mA output signals...
Replies
4
Views
2,251
Hi, I have been struggling for a week with FATEK FBs-24-MAR-AC PLC. My goal is to read voltage and current from a powermeter Elnet Pico 5. The...
Replies
8
Views
3,649
Back
Top Bottom