当加载好主栈驱动程序后,可以通过命令行工具查看主栈和从站的相关信息。

 下面接收命令行的具体功能

1、ethercat alias [ OPTIONS ] < ALIAS >


--alias -a <alias>:从站的别名;
--position -p <pos>:从站的绝对位置;
--force -f:所有从站;

配置从站别名

ethercat alias --p 0 0x1001

2、ethercat config [ OPTIONS ]


* --alias -a <alias>:从站的别名;
* --position -p <pos>:从站的绝对位置;
* --verbose -v:显示详细信息;

查看从站配置信息
ethercat config -p 0 -v (需要启动应用程序才能查看到配置信息)

3、ethercat cstruct [ OPTIONS ]


* --alias -a <alias>:从站的别名;
* --position -p <pos>:从站的绝对位置;

查看从站配置的数据结构,和应用程序的配置结构一致
ethercat cstruct -p 0

4、ethercat data [ OPTIONS ]


--domain -d <index> <index>:域的索引值,不填写则显示所有过程数据。

查看应用程序和从站pdo数据
ethercat data -d 0 (需要启动应用程序,配置pdo数据后才能看到)

5、ethercat debug <LEVEL>


LEVEL:
* 0 : 无任何调试信息输出
* 1 : 输出部分调试信息
* 2 : 输出所有的调试内容包括收发的数据报文

设置主栈调试信息打印级别
 ethercat debug 1

6、ethercat domains [ OPTIONS ]


* --domain -d <index> <index>:根据索引号,匹配域;
* --verbose -v:显示域的详细信息(FMMU和过程数据的信息);

domain记录了配置的pdo和FMMU的相关信息,同样需要启动应用程序,配置了相关数据后才能查看。

ethercat domains

ethercat domains -v


 

7、ethercat download [ OPTIONS ] <INDEX> <SUBINDEX> <VALUE>


⑴ :
* INDEX:16位无符整型的SDO索引;
* SUBINDEX:8位无符整型的SDO子索引;
* VALUE:需写入的SDO的值

⑵ [ OPTIONS ]参:
* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对位置;
* --type -t <type>:SDO条目的数据类型;

type可使用的类型有:
bool、int8、int16、int32、int64、uint8、uint16、uint32、uint64、float、double、string、octet_string、unicode_string

配置从站的sdo数据

ethercat download -t int8 -p 0 0x6060 00 08

 8、ethercat upload [ OPTIONS ] <INDEX> <SUBINDEX>


⑴ :
* INDEX:16位无符整型的SDO索引;
* SUBINDEX:8位无符整型的SDO子索引;

⑵ [ OPTIONS ]参:
* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对位置;
* --type -t <type>:SDO条目的数据类型;

type可使用的类型有:
bool、int8、int16、int32、int64、uint8、uint16、uint32、uint64、float、double、string、octet_string、unicode_string

读取从站的sdo数据
 ethercat upload -t int8 -p 0 0x6060 00

 

 9、ethercat eoe

显示etherne报文的相关信息,一般很少有设备支持eoe功能。

10、ethercat foe_read [ OPTIONS ] <SOURCEFILE>

FOE为文件传输协议,可以向从站写入配置文件
① 参数
* <SOURCEFILE>:为从站中的源文件;

② [ OPTIONS ]参数
* --output -file -o <file> <file>:为读取数据的存储文件,缺省的话数据将读取到stdout;
* --alias:匹配从站的别名;
* --position:匹配从站的绝对位置;

11、ethercat foe_write [ OPTIONS ] <FILENAME>


① 参数
* <FILENAME>:为要发送的文件(指定路径+文件名),也可以为” - “,表示从标准输入中读取文件;

② [ OPTIONS ]参数
* --output -file -o <file> <file>:为从站存储的目标文件名,假如不指定名字,则为主站发送 FILENAME的去掉路径的名字;
* --alias:匹配从站的别名;
* --position:匹配从站的绝对位置;


12、ethercat graph [ OPTIONS ]

查看当前总线拓扑,也就是从站的连接顺序
ethercat graph

13、ethercat master [ OPTIONS ]


--master -m <indices>:indices为主站的索引。默认显示所有的设备信息;

查看主栈信息
 ethercat master

14、ethercat pdos [OPTIONS]


* --alias -a <alias>:从站的别名;
* --position -p <pos>:从站的绝对位置;
* --skin -s <skin>:”skin”可选择”default“和”etherlab“;

查看从站的SM和pdo数据
 ethercat pdos -p 0 

 15、ethercat reg_read [ OPTIONS ] <ADDRESS> [ SIZE ]


① 可选参数
* ADDRESS:16位无符号的寄存器地址;
* SIZE:要读取的对应寄存器字节数(16位无符号值);

② [ OPTIONS ]参数
* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对位置;
* --type -t <type>:匹配数据类型;

type可使用的类型有:
bool、int8、int16、int32、int64、uint8、uint16、uint32、uint64、float、double、string、octet_string、unicode_string

对于sign-and-magnitude coding有:
sm8、sm16、sm32、sm64


ethercat reg_read -p 0 -t sm32 0x0928
获取从站0的0x0928寄存器所存储的值。

ethercat reg_write [ OPTIONS ] <ADDRESS> <DATA>


① 可选参数
* ADDRESS:16位无符号的寄存器地址;
* DATA:要写入寄存器的数据;

② [ OPTIONS ]参数
* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对地址;
* --type -t <type>:匹配数据类型;
* --emergency -e:以紧急的方式请求写入文件;


ethercat reg_write -p 0 -t sm32 0x0928 100
向从站5的寄存器0x0928写入数据100。
 

16、ethercat sdos [ OPTIONS ]


* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对位置;
* --quiet -q:只输出PDOs,不输出PDO条目信息;

17、ethercat sii_read [OPTIONS]


* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对位置;
* --verbose -v:分类显示数据文本内容;
ethercat sii_read -p 0 -v
按内容分类形式显示sii的内容;
ethercat sii_read -p 0 | hexdump
16进制形式显示sii的内容;
 ethercat sii_read -p 0 > sii.bin
将sii的内容写入到sii.bin文件

ethercat sii_write [ OPTIONS ] <FILENAME>


* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对位置;
* --force -f:不进行有效检查;
ethercat sii_read -p 0 sii.bin
将sii.bin的内容写入从站0的SII中。
 

18、ethercat slaves [ OPTIONS ]


* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对地址;
* --verbose -v:显示从站的详细信息;


ethercat slaves -v

显示当前总线上有从站的详细信息

19、ethercat xml [ OPTIONS ]


* --alias -a <alias>:匹配从站的别名;
* --position -p <pos>:匹配从站的绝对地址;

ethercat xml 
生成当前总线连接的所有从站的描述信息类似esi

总结:

常用的命令行有 ethercat slave 查看当前总线上是否识别到连接的从站设备

ethercat cstruct  查看从站的配置数据,应用程序中可以按这个配置配置从站

ethercat master 查看当前的主栈状态,报文统计等信息
 

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐