涉及的从站寄存器:Register AL Status 0x0130:0x0131 。
1,发送报文
1)IgH dmesg看到的报文
[18773.590655] geshifei ec_master_send_datagrams 1059: Adding datagram datagram->index=0 [18773.590656] EtherCAT DEBUG 0: frame size: 46 [18773.590656] EtherCAT DEBUG 0: Sending frame: [18773.590658] EtherCAT DEBUG: FF FF FF FF FF FF 6C 24 08 29 52 19 88 A4 0E 10 [18773.590664] EtherCAT DEBUG: 07 00 00 00 30 01 02 00 00 00 00 00 00 00 00 00 [18773.590669] EtherCAT DEBUG: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [18773.590674] EtherCAT DEBUG: 00 00 00 00 00 00 00 00 00 00 00 00 |
2)报文解析
3)wireshark报文
2,接收报文
1)IgH dmesg看到的报文
[18773.710617] EtherCAT DEBUG 0: Received frame: [18773.710618] EtherCAT DEBUG: FF FF FF FF FF FF 6E 24 08 29 52 19 88 A4 0E 10 [18773.710624] EtherCAT DEBUG: 07 00 01 00 30 01 02 00 00 00 02 00 01 00 00 00 [18773.710628] EtherCAT DEBUG: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [18773.710633] EtherCAT DEBUG: 00 00 00 00 00 00 00 00 00 00 00 00 |
2)报文解析
与发送报文差不多,有4个地方有变化:
- “目的mac”被从站改动了一个字节,6C改成了6E。为什么这样改,不清楚,感觉没必要。
- “从站地址ADP”,更新成了从站的地址。测试时只有一个从站,所以响应报文中只有一个子报文,从站地址为0x0001(报文图例中,低字节在左边) 。
- “子报文数据”,更新成从站的响应数据,0x0130的响应数据2个字节,编码见上图。
- “Working Count”有1个从站响应,所以计数值变成1。