Siemens SINUMERIK 840D sl Function Manual page 1262

Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

Detailed description
2.14 Programming tips with STEP 7
FUNCTIONBLOCK FB 99
T
L
T
L
T
L
LAR1 ;
OPEN
L
2.14.4
Multiinstance DB
With version 7 and higher of STEP 7, FBs might have a multiinstance capability, i.e., they
might incorporate multiinstance DBs. The primary characteristic of multiinstance DBs is that
a block can be used for various instances of FBs (see STEP 7 documentation). As such, the
quantity structure of the DBs can be optimized.
Multi-instance DBs should be activated only when they are actually going to be used since
they increase the runtime and code size of the FBs.
Note
When complex programs are implemented in multiinstance FBs that use a pointer and
address register, it is important for the programmer to observe certain rules.
With multiinstance DBs, the start address of the variable (VAR_INPUT, VAR_OUTPUT,
VAR_IN_OUT, VAR) is transferred with the DI data block register and address register AR2.
When variables are accessed within the multiinstance FB, the compiler independently
controls the access operation via address register AR2. However, when complex program
sections also have to work with address registers in the same FB (e.g., to copy data), then
the old contents of AR2 must be saved before the register is changed. The contents of AR2
must be restored to their original state before an instance variable (VAR_INPUT,
VAR_OUTPUT, VAR_IN_OUT, VAR) is accessed. The AR2 register of the instance is to be
saved most usefully in a local variable (VAR_TEMP).
The command "Load pointer to an instance variable" returns a pointer value from the start of
the instance data. To be able to access this variable via a pointer, the offset stored in AR2
must be added.
278
#typ;
DIW [AR1,P#2.0];
#Amount;
DIW [AR1,P#4.0];
#dbchr;
DID [AR1,P#6.0];
DB [#dbchr];
B [AR1,P#0.0];
Comment
//Retrieve amount
//Retrieve DB number
//Offset part of pointer
//Open DB of variables
//Retrieve byte value using ANY
Basic logic functions: PLC Basic program powerline (P3 pl)
Function Manual, 11/2006, 6FC5397-0BP10-2BA0

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840di slSinumerik 840dSinumerik 840diSinumerik 810dSinumerik 840d powerlineSinumerik 840de powerline ... Show all

Table of Contents