4
Data Exchange between User Program and AS−i Slaves
52
CP 343−2 / CP 343−2 P AS−Interface Master
Release 08/2008
C79000−G8976−C149−04
4.4.2
Programming Examples
Table 4-5
STL
Explanation
//Read in analog input data for slave 5:
Call SFC 59
REQ
:=TRUE
IOID
:=B#16#54
LADDR
:=W#16#100
RECNUM
:=B#16#8D
RET_VAL :=MW14
BUSY
:=M9.2
RECORD
:=P#DB20.DBX64.0 BYTE 8
//Examples: processing analog values:
L
DB20DBW 64
+
400
T
DB20.DBW 88
T
DB20.DBW 106
//Output analog output data for slave 5..8:
CALL SFC 58
REQ
:=TRUE
IOID
:=B#16#54
LADDR
:=W#16#100
RECNUM
:=B#16#8D
RECORD
:=P#DB20.DBX80.0 Byte 32
RET_VAL ::=MW16
BUSY
:=M9.3
//RD_REC
//Permanent trigger
//Fixed value
//CP address (here 256 dec.)
//DSNR=141 (analog data slave 5...)
//Dest. area analog input data
//Slave 5, input channel 1
//Slave 6, output channel 1
//Slave 8, output channel 2
//WR_REC
//Permanent trigger
//Fixed value
//CP address (here 256 dec.)
//DSNR=141 (analog data slave 5...)
//Source area analog output data
-