SmartPLC DataLine with EtherCAT slave interface
159
>
Example: Read list of projected slaves (LPS)
42898
Task:
Read list of projected AS-i slaves on AS-i master 2
Solution:
Read acyclic data set DS10 of the device
Preparations
►
Create empty array for return values of the data set (e.g. arRxData):
Word
Value
Description
1
blank
user ID (UID)
2
blank
reflected command number
3
blank
command status
4
blank
command error code
5
blank
List of projected slaves (LPS):
→
Details of the slave lists
6
blank
7
blank
8
blank
The words 1...4 contain the administration information of the command. The user data is
stored as from the 5th word in the array. (
→ Principle of the command channels)
1 Read data set
►
Execute function block FB_EcCoESdoRead with the following input values:
Input
Value
Description
nNetId
depends on the project
AMS network ID of the EtherCAT master
nSlaveAddr
depends on the project
EtherCAT address of the device
nSubIndex
0x0A
subindex of the fieldbus object (number of the data set)
nIndex
0x2013
Index of the field bus object (read/write an acyclic data set)
pSrcBuf
ADR(arTxData)
address of the buffer storage for return values
cbBufLen
SIZEOF(arTxData)
Number of words to be transferred
2 Evaluate return values
►
After faultless function block processing: Evaluate the command status (word 3) and command error code (word 4)
in the buffer storage.
>
If successful: Words 5...8 of the buffer storage contain the list of projected slaves (LPS).