POINTER

Top  Previous  Next

 

1.) Pointers are 4 bytes big and they are used to point at bits in the I-, Q or M- or D-area.

No process data are saved in it but an address inside the PLC. The internal format is difficult to read but if you use the P# - notation you realize immediately to which memory position the pointer points:

 

     P#5.7      points to the Bit 5.7 of any data area

     P#I 4.5    points to the Bit I 4.5

     P#Q 3.1    points to the Bit Q 3.1

     P#M 12.0   points to the Bit M 12.0

     P#D 3.2    this notation is not permitted,

                you have to access data bits

                in another way.

 

A common example:

 

     L P#6.8

     T MD 10

     ....

     ....

     A I[MD10]

 

2.) The data type POINTER in the declaration part of FBs/FCs is 6 bytes big, because in this case a possible DB number is saved as well. We admit honestly that we still do not know what to do with the pointers in STEP®7 in the declaration part. You cannot load them (because they are too big for the 4 bytes wide accu), you cannot use them in the L xx[AR1,P#I 5.3]-notation instead of the P#I. 5.3 and you cannot transfer them as parameter to other FBs/FCs. The only use that we have found is with some SFCs. We are very grateful for advices how to use these POINTERS.

 

Internally in a HSB of a pointer is initially saved to which data area it points:

 

I        81h        // Input area

Q        82h        // Output area

M        83h        // Marker area

D        84h        // Global-DB

ID        85h        // Instance-DB

L        86h        // Local data

FX        87h        // Parameter area of a function (further local data)

 

In the next 24 bits the byte address follows but it is shifted left about 3 bits. In the 3 bits which are released by this the bit number is finally saved.

 

See also:

Data Types

 

STEP®7 is a registered trademark of the Siemens AG.