Printed in the Federal Republic of Germany
TR-Electronic GmbH 2009, All Rights Reserved
04/23/2020
TR - ELA - BA - DGB - 0015 - 13
Page 85 of 92
6.5.1 Sample program, acyclic write service
To perform a Preset, with the aid of the System-Function-Block "SFB53" (WRREC),
an acyclic write service must be executed. Therefore, no more cyclical output data are
needed to provide a position value.
Figure 9: Preset execution by means of the CPU 315-2 PN/DP and SFB53
Function call, example for magnet 1:
CALL „WRREC“ , DB53
REQ :=TRUE
ID :=DW#16#0
INDEX :=2
LEN :=4
DONE :=
BUSY :=
ERROR :=
STATUS :=
RECORD :=#encoder
For
ID,
here 0 is specified. This corresponds to the logical address of the
measuring system (address of the input data in HEX)
Index = 2
means PRESET execution for magnet 1
The variable
encoder
contains the desired value
Further information about the SFB53 can be taken from the system documentation of
the control unit.
6.5.2 Switch-on / Switch-off the State change (Data status)
If the Preset adjustment function is executed the cyclic Real-Time-Data are set to
“BAD”, see chapter “Data status” on page 87. When the procedure was finished
completely, the data status is reset to “GOOD”. If a changing of the status is
undesired, this function can be switched off by setting the two most significant bits:
Output double word ODx
Byte
x+0
x+1
x+2
x+3
Bit
31
– 24
23
– 16
15
– 8
7
– 0
Data 2
31
-2
30
2
29
- 2
24
2
23
- 2
16
2
15
- 2
8
2
7
- 2
0
ON
00
xxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
OFF
11
xxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
STATUS
Preset adjustment value (binary)