SmartPLC DataLine with EtherCAT slave interface
162
►
Evaluate the status of the command processing (bRxStatus).
3 Receive command response from the device
►
After faultless function block processing: 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
0x03
subindex of the fieldbus object (command response)
nIndex
0x2012
Index of the fieldbus object (AS-i Master 2 command)
pSrcBuf
ADR(arRxData)
Buffer storage for data to be transmitted
cbBufLen
SIZEOF(arRxData)
Number of words to be transferred
►
Evaluate the command status (word 3) and command error code (word 4) in the buffer storage.
>
If successful: AS-i Master 2 is in the projection mode.
>
Example: Read date / time / NTP settings
42891
Task:
Read date / time / NTP settings of the device
Solution:
Execute command 0x010B
Preparations
►
Create data structure for values to be transferred to the device (arTxData):
Word
Value
Description
1
UID
User ID (value between 0 and 65535 to mark the request)
2
0x010B
Command number
→
Command 0x010B – Read date / time / NTP settings
3
0x4F42
Boot sequence 1 (0x4F = O, 0x42 = B)
4
0x544F
Boot sequence 2 (0x54 = T, 0x4F = O)
►
Create empty data structure for status message of the command processing (bRxStatus)
Byte
Value
Description
1
blank
Status message of command processing (index 0x02)
►
Create empty data structure for values of the command response (arRxData):
Word
Value
Description
1
blank
UID value between 0 and 65535 to mark the request
2
blank
reflected command number
3
blank
MSB = reserved, LSB = command status
4
blank
Command error code
5
blank
Date / time / NTP settings
→
Command 0x010B – Read date / time / NTP settings
...
...
11
blank