Siemens SINUMERIK 840Di Function Manual page 1170

Basic machine
Hide thumbs Also See for SINUMERIK 840Di:
Table of Contents

Advertisement

Detailed description
2.14 Useful tips on programming with STEP 7
2.14.3
ANY and POINTER
2.14.3.1
General
General
The following programming examples illustrate different programming mechanisms. They
demonstrate how input/output and transit variables (VAR_INPUT, VAR_OUTPUT,
VAR_IN_OUT) are accessed by data types "POINTER" or "ANY" within an FC or FB. The
access operations are described in such a way that a part symbolic method of programming
can be used.
2.14.3.2
Use of POINTER and ANY in FC if POINTER or ANY is available as parameter
Description of functions
FC 99 has inputs parameters that are defined as POINTER or ANY. The example shows a
body program via which the subcomponents of the POINTER or ANY can be accessed. In
this case, the DB parameterized with POINTER or ANY is opened and the address offset
stored as a cross area pointer in address register AR1, thus allowing access to data
elements of variables (generally structures and arrays) that are addressed via the POINTER,
ANY. This access operation is described at the end of the relevant program sequence in the
example. With data type ANY, it is also possible to execute a check or branch when the
variable is accessed based on the data type and the number of elements involved.
FUNCTION FC 99: VOID
VAR_INPUT
Row : BYTE ;
Convert : BOOL ;
Addr: POINTER;
Addr1 : ANY ;
END_VAR
VAR_TEMP
dbchr : WORD ;
Number: WORD ;
type : BYTE ;
END_VAR
BEGIN
NETWORK
TITLE =
L
LAR1 ;
L
2-258
P##Addr;
W [AR1,P#0.0];
Comment
//Activate numerical conversion
//Points to variable
//POINTER
//Retrieve pointer
//Retrieve DB number
Function Manual, 08/2005 Edition, 6FC5397-0BP10-0BA0
Power Line Basic PLC Program (P3)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents