国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

EtherCAT IGH 命令行介紹

這篇具有很好參考價(jià)值的文章主要介紹了EtherCAT IGH 命令行介紹。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

EtherCAT IGH 命令行介紹

  • 在一開始學(xué)習(xí) EtherCAT 的時(shí)候,可以直接編譯 IGH,不需要一上來就去安裝實(shí)時(shí)內(nèi)核。因?yàn)榫幾g IGH 和安不安裝實(shí)時(shí)內(nèi)核沒有什么關(guān)系,而且安裝實(shí)時(shí)內(nèi)核還比較麻煩。當(dāng)我們只是有一兩個(gè)電機(jī)或者IO模塊來學(xué)習(xí)的時(shí)候,可以先不用去安裝實(shí)時(shí)內(nèi)核。

  • 如果是在虛擬機(jī)中安裝了IGH,那么為了能夠掃描到從站,那么就需要在虛擬機(jī)中配置網(wǎng)絡(luò),利用橋接網(wǎng)絡(luò)進(jìn)行設(shè)置。這是因?yàn)樘摂M機(jī)的網(wǎng)絡(luò)地址是虛擬的IP,iP地址和實(shí)際PC上的是不一樣的,所以必須固定和實(shí)際的PC的IP地址保持在同一個(gè)網(wǎng)段。

  • 如果是使用的實(shí)體機(jī),那么只要把PC 和 EtherCAT 從站用網(wǎng)線連接在一起就可以了,不需要單獨(dú)設(shè)置IP地址,直接用DHCP也可以直接連接上。

1、測(cè)試環(huán)境說明

因?yàn)槲屹?gòu)買的電機(jī)是沒有帶編碼器和剎車的,因此就不需要接步進(jìn)驅(qū)動(dòng)器上面的剎車信號(hào)。
如果要跑回零模式的話,那么就需要接步進(jìn)驅(qū)動(dòng)器上面的限位信號(hào)。
另外步進(jìn)驅(qū)動(dòng)器上面的IO接口都是已經(jīng)固定好了作用的,用來接限位和原點(diǎn)傳感器的。

2、ethercat 命令行說明

EtherCAT 命令行在 《EtherCAT IGH 1.52.pdf》中的 <7.1 Command-line Tool> 也有很詳細(xì)的一個(gè)介紹。在編譯和安裝IGH的時(shí)候,如果不修改默認(rèn)的編譯參數(shù),那么就是會(huì)提供 EtherCAT 命令行工具的。

每個(gè)主站的實(shí)例都有生成一個(gè)字符設(shè)備,名字為:/dev/EtherCATx, 其中 x ∈ {0 . . . n}為主站實(shí)例的索引。
下面具體的介紹了一下各參數(shù)及命令的使用,其中 [ ] 中為必選參數(shù),< >可選參數(shù)。

2.1 ethercat --help

該命令行會(huì)告訴用戶當(dāng)前支持哪些命令行指令參數(shù),當(dāng)前總共提供了 28 個(gè)命令行指令。

@:~$ ethercat --help
  alias      Write alias addresses.
  config     Show slave configurations.
  crc        CRC error register diagnosis.
  cstruct    Generate slave PDO information in C language.
  data       Output binary domain process data.
  debug      Set the master's debug level.
  domains    Show configured domains.
  download   Write an SDO entry to a slave.
  eoe        Display Ethernet over EtherCAT statictics.
  foe_read   Read a file from a slave via FoE.
  foe_write  Store a file on a slave via FoE.
  graph      Output the bus topology as a graph.
  ip         Set EoE IP parameters.
  master     Show master and Ethernet device information.
  pdos       List Sync managers, PDO assignment and mapping.
  reg_read   Output a slave's register contents.
  reg_write  Write data to a slave's registers.
  rescan     Rescan the bus.
  sdos       List SDO dictionaries.
  sii_read   Output a slave's SII contents.
  sii_write  Write SII contents to a slave.
  slaves     Display slaves on the bus.
  soe_read   Read an SoE IDN from a slave.
  soe_write  Write an SoE IDN to a slave.
  states     Request application-layer states.
  upload     Read an SDO entry from a slave.
  version    Show version information.
  xml        Generate slave information XML.

Global options:
  --master  -m <master>  Comma separated list of masters
                         to select, ranges are allowed.
                         Examples: '1,3', '5-7,9', '-3'.
                         Default: '-' (all).
  --force   -f           Force a command.
  --quiet   -q           Output less information.
  --verbose -v           Output more information.
  --help    -h           Show this help.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

Call 'ethercat <COMMAND> --help' for command-specific help.

2.2 ethercat alias

該命令行主要是用來創(chuàng)建 EtherCAT 從站的別名的。


ethercat alias [OPTIONS] <ALIAS>

Write alias addresses.

Arguments:
  ALIAS must be an unsigned 16 bit number. Zero means
        removing an alias address.

If multiple slaves are selected, the --force option
is required.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --force    -f          Acknowledge writing aliases of
                         multiple slaves.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –force -f:確認(rèn)寫入多個(gè)從站別名;

上面的-a 和 -p 參數(shù)后面很多的命令行都會(huì)用到。

例子

sudo ethercat alias --position 0 0x3000 

解析:將在bus總線上對(duì)應(yīng)的從站0的別名(默認(rèn)為0)為0x3000;
注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.3 ethercat master

該命令行用來顯示主站和以太網(wǎng)設(shè)備信息。

ethercat master --help
ethercat master [OPTIONS]

Show master and Ethernet device information.

Command-specific options:
  --master -m <indices>  Master indices. A comma-separated
                         list with ranges is supported.
                         Example: 1,4,5,7-9. Default: - (all).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

可選參數(shù)

  • –master -m :indices為主站的索引。默認(rèn)顯示所有的設(shè)備信息;

例子

@:~$ ethercat master
Master0
  Phase: Idle
  Active: no
  Slaves: 1
  Ethernet devices:
    Main: 98:29:a6:56:57:ce (attached)
      Link: UP
      Tx frames:   5847
      Tx bytes:    534212
      Rx frames:   5846
      Rx bytes:    534152
      Tx errors:   0
      Tx frame rate [1/s]:    125    307     87
      Tx rate [KByte/s]:      7.3   27.4    7.8
      Rx frame rate [1/s]:    125    307     87
      Rx rate [KByte/s]:      7.3   27.4    7.8
    Common:
      Tx frames:   12089
      Tx bytes:    915900
      Rx frames:   6797
      Rx bytes:    598380
      Lost frames: 5292
      Tx frame rate [1/s]:    125    353    149
      Tx rate [KByte/s]:      7.3   30.3   11.5
      Rx frame rate [1/s]:    125    327     99
      Rx rate [KByte/s]:      7.3   28.7    8.6
      Loss rate [1/s]:          0     27     50
      Frame loss [%]:         0.0    7.5   33.4
  Distributed clocks:
    Reference clock:   Slave 0
    DC reference time: 0
    Application time:  0
                       2000-01-01 00:00:00.000000000

顯示所有主機(jī)的設(shè)備信息(發(fā)送幀、接收幀、參考時(shí)鐘、應(yīng)用時(shí)間)。
后面的 Distributed clocks 只有在啟動(dòng)應(yīng)用程序之后才會(huì)有相應(yīng)的參數(shù)值。

當(dāng)給定的主站參數(shù)無效的時(shí)候,會(huì)輸處如下報(bào)錯(cuò)信息。

@:~$ ethercat master -m 1
Failed to open master device /dev/EtherCAT1: No such file or directory

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。文章來源地址http://www.zghlxwxcb.cn/news/detail-405577.html

2.4 ethercat slaves

@:~$ ethercat slaves --help
ethercat slaves [OPTIONS]

Display slaves on the bus.

If the --verbose option is not given, the slaves are
displayed one-per-line. Example:

1  5555:0  PREOP  +  EL3162 2C. Ana. Input 0-10V
|  |    |  |      |  |
|  |    |  |      |  \- Name from the SII if available,
|  |    |  |      |     otherwise vendor ID and product
|  |    |  |      |     code (both hexadecimal).
|  |    |  |      \- Error flag. '+' means no error,
|  |    |  |         'E' means that scan or
|  |    |  |         configuration failed.
|  |    |  \- Current application-layer state.
|  |    \- Decimal relative position to the last
|  |       slave with an alias address set.
|  \- Decimal alias address of this slave (if set),
|     otherwise of the last slave with an alias set,
|     or zero, if no alias was encountered up to this
|     position.
\- Absolute ring position in the bus.

If the --verbose option is given, a detailed (multi-line)
description is output for each slave.

Slave selection:
  Slaves for this and other commands can be selected with
  the --alias and --position parameters as follows:

  1) If neither the --alias nor the --position option
     is given, all slaves are selected.
  2) If only the --position option is given, it is
     interpreted as an absolute ring position and
     a slave with this position is matched.
  3) If only the --alias option is given, all slaves
     with the given alias address and subsequent
     slaves before a slave with a different alias
     address match (use -p0 if only the slaves
     with the given alias are desired, see 4)).
  4) If both the --alias and the --position option are
     given, the latter is interpreted as relative
     position behind any slave with the given alias.

Command-specific options:
  --alias    -a <alias>  Slave alias (see above).
  --position -p <pos>    Slave position (see above).
  --verbose  -v          Show detailed slave information.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.
  • 如果最后的 -v 參數(shù)沒有設(shè)置,顯示的參數(shù)含義如下:
1  5555:0  PREOP  +  EL3162 2C. Ana. Input 0-10V
|  |    |  |      |  |
|  |    |  |      |  \- 從SII 上面讀取到的從站名字(如果有設(shè)置的話)?;蛘?|  |    |  |      |     是 vendor ID and product code ,兩個(gè)參數(shù)都是用 
|  |    |  |      |     十進(jìn)制表示的。
|  |    |  |      |     
|  |    |  |      \- 錯(cuò)誤標(biāo)志。 '+' 意味著是沒有錯(cuò)誤,
|  |    |  |         'E' 意味著存在配置方面的錯(cuò)誤或者其他錯(cuò)誤。
|  |    |  |        
|  |    |  \- 當(dāng)前從站的狀態(tài)。
|  |    |  
|  |    \- 十進(jìn)制表示的與最后一個(gè)設(shè)置了別名地址的從站設(shè)備的相對(duì)位置。
|  |       
|  \- 用十進(jìn)制表示的一個(gè)從站別名地址(如果有進(jìn)行設(shè)置的話),
|     否則為設(shè)置的最后一個(gè)從機(jī)別名的地址。
|     如果在此位置之前未遇到設(shè)置了別名的從站設(shè)備,則為零。
|       
\- 代表在總線上的絕對(duì)位置.

如果設(shè)置了最后的 -v 參數(shù),則為每一個(gè)從站輸出相應(yīng)的描述。

該命令行中從站的選擇是通過參數(shù) -a 和 -p 來選擇的。

  • 1、如果沒有設(shè)置 --alias 和 --position 這兩個(gè)選項(xiàng)參數(shù),則會(huì)選擇所有的從站設(shè)備。
  • 2、如果只給出 --position 選項(xiàng)參數(shù),那么總線上絕對(duì)位置為該值的從站設(shè)備會(huì)被選中。
  • 3、如果只給出了–alias 選項(xiàng)參數(shù),則具有給定別名地址的所有從屬設(shè)備和具有不同別名地址的從屬設(shè)備之前的后續(xù)從屬設(shè)備都會(huì)匹配。(如果只需要具有給定別名的從機(jī),請(qǐng)使用-p0,請(qǐng)參見4):
  • 4、如果 --alias 和 --position 這個(gè)兩個(gè)參數(shù)同時(shí)給定,后者被解釋為相對(duì)
    位于具有給定別名的任何從屬設(shè)備后面。

這邊關(guān)于從站的別名配置以及匹配的方法介紹,可以參照 《EtherCAT IGH 1.52.pdf》中的 < 3.1.1 Slave Configuration > 介紹。

或者閱讀下面這兩個(gè)文章,這兩個(gè)文章介紹的也是很詳細(xì)的。
Ethercat解析(十)之從站配置

IgH Master 1.5.2 Documentation 中文版 2.1從站的配置

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –verbose -v :顯示從站的詳細(xì)信息。

例子

@:~$ ethercat slaves
0  0:0  PREOP  +  2DM522-EC

此時(shí)表示從站已經(jīng)進(jìn)入了 PEROP 狀態(tài)了。

@:~$ ethercat slaves 
0  0:0  SAFEOP+ERROR  E  2DM522-EC

此時(shí)可以看到當(dāng)前的從站已經(jīng)進(jìn)入了 SAFEOP 的狀態(tài)了。但是后面還有一個(gè) + ERROR。這個(gè)根據(jù) ethercat states --help 可以看到這個(gè)表示 ethercat 從站出現(xiàn)錯(cuò)誤,可能是掃描錯(cuò)誤,也有可能是配置出錯(cuò)了。

下面這個(gè)例子采用 -v 參數(shù)顯示從站的具體信息。在打印出來的具體參數(shù)中可以看到 Vendor IdProduct code,這個(gè)兩個(gè)參數(shù)在后面我們編寫主站應(yīng)用程序的時(shí)候需要用到。另外還可以看到郵箱服務(wù)中該驅(qū)動(dòng)器只支持 COE 服務(wù), 不支持 FOE、SOE、EOE等服務(wù)。

@:~$ ethercat slaves -a 0 -p 0 -v
=== Master 0, Slave 0 ===
Device: Main
State: OP
Flag: +
Identity:
  Vendor Id:       0x66668888
  Product code:    0x20190303
  Revision number: 0x20190620
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 0 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0  MII   up    open    yes             -   3810966012           0           0
   1  MII   down  closed  no              -            -           -           -
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1200/256
  Supported protocols: CoE
General:
  Group: 2DM Slave
  Image name: 
  Order number: 2DM522-EC
  Device name: 2DM522-EC
  CoE details:
    Enable SDO: yes
    Enable SDO Info: yes
    Enable PDO Assign: yes
    Enable PDO Configuration: yes
    Enable Upload at startup: no
    Enable SDO complete access: yes
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 0 mA

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.5 ethercat states

該命令行用來請(qǐng)求從站轉(zhuǎn)換狀態(tài)。

@:~$ ethercat states --help
ethercat states [OPTIONS] <STATE>

Request application-layer states.

Arguments:
  STATE can be 'INIT', 'PREOP', 'BOOT', 'SAFEOP', or 'OP'.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

必選參數(shù)介紹

  • STATE:可選的參數(shù)有INIT、PREOP、BOOT、SAFEOP、OP;

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;

例子

sudo ethercat states -p 0 OP 

用于將從站0的狀態(tài)切換為OP;

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.6 ethercat graph

該命令行用來輸出總線上連接的所有從站設(shè)備的總線拓?fù)鋱D。

ethercat graph [OPTIONS]
ethercat graph [OPTIONS] <INFO>

Output the bus topology as a graph.

The bus is output in DOT language (see
http://www.graphviz.org/doc/info/lang.html), which can
be processed with the tools from the Graphviz
package. Example:

  ethercat graph | dot -Tsvg > bus.svg

See 'man dot' for more information.

Additional information at edges and nodes is selected via
the first argument:
  DC  - DC timing
  CRC - CRC error register information

例子

以文本的信息輸出從站連接拓?fù)鋱D。

@:~$ ethercat graph
/* EtherCAT bus graph. Generated by 'ethercat graph'. */

strict graph bus {
    rankdir="LR"
    ranksep=0.8
    nodesep=0.8
    node [fontname="Helvetica"]
    edge [fontname="Helvetica",fontsize="10"]

    master [label="EtherCAT\nMaster"]
    master -- slave0[label="MII"]

    slave0 [shape="box",label="0 / 0:0\n2DM522-EC"]

}

將總線拓?fù)鋱D輸出到桌面,保存成 svg 格式的圖片。

sudo ethercat graph | dot -Tsvg > ~/Desktop/bus.svg 

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.7 ethercat xml

@:~$ ethercat xml --help
ethercat xml [OPTIONS]

Generate slave information XML.

Note that the PDO information can either originate
from the SII or from the CoE communication area. For
slaves, that support configuring PDO assignment and
mapping, the output depends on the last configuration.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;

例子

@:~$ ethercat xml
<?xml version="1.0" ?>
<EtherCATInfo>
  <!-- Slave 0 -->
  <Vendor>
    <Id>1717995656</Id>
  </Vendor>
  <Descriptions>
    <Devices>
      <Device>
        <Type ProductCode="#x20190303" RevisionNo="#x20190620">2DM522-EC</Type>
        <Name><![CDATA[2DM522-EC]]></Name>
        <Sm Enable="1" StartAddress="#x1000" ControlByte="#x26" DefaultSize="128" />
        <Sm Enable="1" StartAddress="#x1200" ControlByte="#x22" DefaultSize="256" />
        <Sm Enable="1" StartAddress="#x1400" ControlByte="#x64" DefaultSize="17" />
        <Sm Enable="1" StartAddress="#x1600" ControlByte="#x20" DefaultSize="31" />
        <RxPdo Sm="2" Fixed="1" Mandatory="1">
          <Index>#x1600</Index>
          <Name>RxPdoMapping</Name>
          <Entry>
            <Index>#x6040</Index>
            <SubIndex>0</SubIndex>
            <BitLen>16</BitLen>
            <Name>controlword</Name>
            <DataType>UINT16</DataType>
          </Entry>
          <Entry>
            <Index>#x6060</Index>
            <SubIndex>0</SubIndex>
            <BitLen>8</BitLen>
            <Name>op_mode</Name>
            <DataType>UINT8</DataType>
          </Entry>
          <Entry>
            <Index>#x607a</Index>
            <SubIndex>0</SubIndex>
            <BitLen>32</BitLen>
            <Name>target_position</Name>
            <DataType>UINT32</DataType>
          </Entry>
          <Entry>
            <Index>#x60b8</Index>
            <SubIndex>0</SubIndex>
            <BitLen>16</BitLen>
            <Name>Touch_probe_function</Name>
            <DataType>UINT16</DataType>
          </Entry>
          <Entry>
            <Index>#x60fe</Index>
            <SubIndex>1</SubIndex>
            <BitLen>32</BitLen>
            <Name>physical_outputs</Name>
            <DataType>UINT32</DataType>
          </Entry>
          <Entry>
            <Index>#x60fe</Index>
            <SubIndex>2</SubIndex>
            <BitLen>32</BitLen>
            <Name>bit_mask</Name>
            <DataType>UINT32</DataType>
          </Entry>
        </RxPdo>
        <TxPdo Sm="3" Fixed="1" Mandatory="1">
          <Index>#x1a00</Index>
          <Name>TxPdoMapping</Name>
          <Entry>
            <Index>#x603f</Index>
            <SubIndex>0</SubIndex>
            <BitLen>16</BitLen>
            <Name>errorcode</Name>
            <DataType>UINT16</DataType>
          </Entry>
          <Entry>
            <Index>#x6041</Index>
            <SubIndex>0</SubIndex>
            <BitLen>16</BitLen>
            <Name>statusword</Name>
            <DataType>UINT16</DataType>
          </Entry>
          <Entry>
            <Index>#x6061</Index>
            <SubIndex>0</SubIndex>
            <BitLen>8</BitLen>
            <Name>op_mode_display</Name>
            <DataType>UINT8</DataType>
          </Entry>
          <Entry>
            <Index>#x6064</Index>
            <SubIndex>0</SubIndex>
            <BitLen>32</BitLen>
            <Name>actual_position</Name>
            <DataType>UINT32</DataType>
          </Entry>
          <Entry>
            <Index>#x60b9</Index>
            <SubIndex>0</SubIndex>
            <BitLen>16</BitLen>
            <Name>Touch_probe_status</Name>
            <DataType>UINT16</DataType>
          </Entry>
          <Entry>
            <Index>#x60ba</Index>
            <SubIndex>0</SubIndex>
            <BitLen>32</BitLen>
            <Name>Touch_probe_pos1_pos_value</Name>
            <DataType>UINT32</DataType>
          </Entry>
          <Entry>
            <Index>#x60bb</Index>
            <SubIndex>0</SubIndex>
            <BitLen>32</BitLen>
            <Name>Touch_probe_pos1_neg_value</Name>
            <DataType>UINT32</DataType>
          </Entry>
          <Entry>
            <Index>#x60bc</Index>
            <SubIndex>0</SubIndex>
            <BitLen>32</BitLen>
            <Name>Touch_probe_pos2_pos_value</Name>
            <DataType>UINT32</DataType>
          </Entry>
          <Entry>
            <Index>#x60bd</Index>
            <SubIndex>0</SubIndex>
            <BitLen>32</BitLen>
            <Name>Touch_probe_pos2_neg_value</Name>
            <DataType>UINT32</DataType>
          </Entry>
          <Entry>
            <Index>#x60fd</Index>
            <SubIndex>0</SubIndex>
            <BitLen>32</BitLen>
            <Name>digtal_inputs</Name>
            <DataType>UINT32</DataType>
          </Entry>
        </TxPdo>
      </Device>
    </Devices>
  </Descriptions>
</EtherCATInfo>

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.8 ethercat debug

該命令用來設(shè)置主站的調(diào)試級(jí)別。


@:~$ ethercat debug --help

ethercat debug <LEVEL>

Set the master's debug level.

Debug messages are printed to syslog.

Arguments:
  LEVEL can have one of the following values:
        0 for no debugging output,
        1 for some debug messages, or
        2 for printing all frame contents (use with caution!).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

在實(shí)際的調(diào)試過程中的時(shí)候,一般會(huì)和sudo dmesg -w這個(gè)命令一起配合使用。

該命令后終端不會(huì)有任何的信息輸出,但是當(dāng)你在另外一個(gè)終端輸入sudo dmesg -w,你就會(huì)發(fā)現(xiàn)在這個(gè)終端這邊輸出了一些 ethercat 的 debug 信息,前提是你設(shè)置的參數(shù)是 1 或者 2。

參數(shù)介紹

  • –LEVEL :設(shè)置調(diào)試等級(jí)
    • 0 : 無任何調(diào)試信息輸出
    • 1 : 輸出部分調(diào)試信息
    • 2 : 輸出所有的幀的內(nèi)容(由于輸出信息較多,請(qǐng)謹(jǐn)慎使用)

例子

sudo ethercat debug 1

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.9 ethercat version

該命令行用來輸出當(dāng)前主站的版本的。

@:~$ ethercat version --help
ethercat version [OPTIONS]

Show version information.

例子

@:~$ sudo ethercat version
IGH EtherCAT master 1.6.0-rc1 unknow

注意:不連接從站也能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.10 ethercat sdos

該命令行用來輸出當(dāng)前驅(qū)動(dòng)器支持的所有的SDO信息。

@:~$ ethercat sdos --help

ethercat sdos [OPTIONS]

List SDO dictionaries.

SDO dictionary information is displayed in two layers,
which are indented accordingly:

1) SDOs - Hexadecimal SDO index and the name. Example:

   SDO 0x1018, "Identity object"

2) SDO entries - SDO index and SDO entry subindex (both
   hexadecimal) followed by the access rights (see
   below), the data type, the length in bit, and the
   description. Example:

   0x1018:01, rwrwrw, uint32, 32 bit, "Vendor id"

The access rights are specified for the AL states PREOP,
SAFEOP and OP. An 'r' means, that the entry is readable
in the corresponding state, an 'w' means writable,
respectively. If a right is not granted, a dash '-' is
shown.

If the --quiet option is given, only the SDOs are output.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --quiet    -q          Only output SDOs (without the
                         SDO entries).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

該命令行中如果采用采用的默認(rèn)的參數(shù),那么會(huì)輸出一下兩層信息:

  • 1、SDO 的索引和名字信息

    SDO 0x6040, “controlword”

    • 0x6040:SDO 索引值;
    • “controlword”:SDO的名字,表示這是一個(gè)控制字;
  • 2、顯示 SDO 的內(nèi)容,包括各個(gè)子索引的參數(shù)含義、訪問權(quán)限等

    0x6040:00, rwrwrw, uint16, 16 bit, “controlword”"

    • 0x6040:00:代表子索引的地址為 0x0000;
    • rwrwrw:代表著這個(gè) SDO 的訪問權(quán)限; 這個(gè)訪問權(quán)限分別是針對(duì)應(yīng)用層在預(yù)運(yùn)行狀態(tài)(PREOP)、安全運(yùn)行狀態(tài)(SAFEOP)和運(yùn)行狀態(tài)(OP)。'r’表示該條目可讀,‘w’表示該條目可寫。假如對(duì)訪問權(quán)限不太確切,則使用’-'代替;
    • uint16:代表這個(gè)子索引保存的數(shù)據(jù)類型,無符號(hào)整數(shù)數(shù)據(jù), 16 bit;
    • 16 bit:代表這個(gè)子索引數(shù)據(jù)的大小是 16 bit;
    • “controlword”:用來描述這個(gè)子索引的含義;

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –quiet -q :只用來輸出 PDOs,不輸出 PDO 條目信息。

例子

@:~$ ethercat sdos
SDO 0x1000, "Device type"
  0x1000:00, r-r-r-, uint32, 32 bit, "Device type"
SDO 0x1001, "Error register"
  0x1001:00, r-r-r-, uint8, 8 bit, "Error register"
SDO 0x1008, "Device name"
  0x1008:00, r-r-r-, string, 72 bit, "Device name"
SDO 0x1009, "Hardware version"
  0x1009:00, r-r-r-, string, 24 bit, "Hardware version"
SDO 0x100a, "Software version"
  0x100a:00, r-r-r-, string, 32 bit, "Software version"
SDO 0x1010, "store parameters"
  0x1010:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
  0x1010:01, rwrwrw, uint32, 32 bit, "save all parameters"
  0x1010:02, rwrwrw, uint32, 32 bit, "save communication parameters"
  0x1010:03, rwrwrw, uint32, 32 bit, "save application parameters"
  0x1010:04, rwrwrw, uint32, 32 bit, "save manufacturer defined parameters"
..............
SDO 0x6007, "Abort_connection_option_code"
  0x6007:00, rwrwrw, int16, 16 bit, "Abort_connection_option_code"
SDO 0x603f, "errorcode"
  0x603f:00, r-r-r-, uint16, 16 bit, "errorcode"
SDO 0x6040, "controlword"
  0x6040:00, rwrwrw, uint16, 16 bit, "controlword"
SDO 0x6041, "statusword"
  0x6041:00, r-r-r-, uint16, 16 bit, "statusword"
..............

添加 -q 參數(shù),只用來輸出 PDOs,不輸出 PDO 條目信息。

@:~$ ethercat sdos -a 0 -p 0 -q
SDO 0x1000, "Device type"
SDO 0x1001, "Error register"
SDO 0x1008, "Device name"
SDO 0x1009, "Hardware version"
SDO 0x100a, "Software version"
SDO 0x1010, "store parameters"
..............
SDO 0x6007, "Abort_connection_option_code"
SDO 0x603f, "errorcode"
SDO 0x6040, "controlword"
SDO 0x6041, "statusword"
..............

2.11 ethercat pdos

該命令行用來顯示出同步管理器的參數(shù)和PDO分配和映射信息。

@:~$ ethercat pdos --help

ethercat pdos [OPTIONS]

List Sync managers, PDO assignment and mapping.

For the default skin (see --skin option) the information
is displayed in three layers, which are
indented accordingly:

1) Sync managers - Contains the sync manager information
   from the SII: Index, physical start address, default
   size, control register and enable word. Example:

   SM3: PhysAddr 0x1100, DefaultSize 0, ControlRegister 0x20, Enable 1

2) Assigned PDOs - PDO direction, hexadecimal index and
   the PDO name, if available. Note that a 'Tx' and 'Rx'
   are seen from the slave's point of view. Example:

   TxPDO 0x1a00 "Channel1"

3) Mapped PDO entries - PDO entry index and subindex (both
   hexadecimal), the length in bit and the description, if
   available. Example:

   PDO entry 0x3101:01, 8 bit, "Status"

Note, that the displayed PDO assignment and PDO mapping
information can either originate from the SII or from the
CoE communication area.

The "etherlab" skin outputs a template configuration
for EtherLab's generic EtherCAT slave block.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --skin     -s <skin>   Choose output skin. Possible values are
                         "default" and "etherlab".

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

該命令行中如果采用采用的默認(rèn)的參數(shù),那么會(huì)輸出一下三層信息:

  • 1、同步管理器信息

    SM3: PhysAddr 0x1600, DefaultSize 31, ControlRegister 0x20, Enable 1

    • SM3:同步管理器3;
    • PhysAddr:物理地址開始地址 0x1600;
    • DefaultSize:默認(rèn)數(shù)據(jù)大小 31;
    • ControlRegister:控制寄存器 0x20;
    • Enable:使能字 1;
  • 2、顯示PDO方向(TX 或者 RX),索引值,PDO名字

    TxPDO 0x1a00 “TxPdoMapping”

    • TxPDO:代表從站發(fā)送數(shù)據(jù)的方向(從站發(fā)送數(shù)據(jù));
    • 0x1a00:PDO的索引值;
    • “TxPdoMapping”:PDO的名字;
  • 3、顯示PDO條目的索引和子索引(都是以16進(jìn)制的形式現(xiàn)實(shí)的),顯示位寬和描述

    PDO entry 0x6041:00, 16 bit, “statusword”

    * 0x6041:00 : 表示PDO的索引和子索引,當(dāng)前表示為 狀態(tài)字 的索引和子索引地址; 
    * 16bit:表示該條目的位寬,是一個(gè) 16 bit 的數(shù)據(jù); 
    * "statusword":表示該位的描述,表示這個(gè)PDO 描述的是狀態(tài)字;
    

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –skin -s <skin> :用以設(shè)置輸出的形式

例子

@:~$ ethercat pdos
SM0: PhysAddr 0x1000, DefaultSize  128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1200, DefaultSize  256, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1400, DefaultSize   17, ControlRegister 0x64, Enable 1
  RxPDO 0x1600 "RxPdoMapping"
    PDO entry 0x6040:00, 16 bit, "controlword"
    PDO entry 0x6060:00,  8 bit, "op_mode"
    PDO entry 0x607a:00, 32 bit, "target_position"
    PDO entry 0x60b8:00, 16 bit, "Touch_probe_function"
    PDO entry 0x60fe:01, 32 bit, "physical_outputs"
    PDO entry 0x60fe:02, 32 bit, "bit_mask"
SM3: PhysAddr 0x1600, DefaultSize   31, ControlRegister 0x20, Enable 1
  TxPDO 0x1a00 "TxPdoMapping"
    PDO entry 0x603f:00, 16 bit, "errorcode"
    PDO entry 0x6041:00, 16 bit, "statusword"
    PDO entry 0x6061:00,  8 bit, "op_mode_display"
    PDO entry 0x6064:00, 32 bit, "actual_position"
    PDO entry 0x60b9:00, 16 bit, "Touch_probe_status"
    PDO entry 0x60ba:00, 32 bit, "Touch_probe_pos1_pos_value"
    PDO entry 0x60bb:00, 32 bit, "Touch_probe_pos1_neg_value"
    PDO entry 0x60bc:00, 32 bit, "Touch_probe_pos2_pos_value"
    PDO entry 0x60bd:00, 32 bit, "Touch_probe_pos2_neg_value"
    PDO entry 0x60fd:00, 32 bit, "digtal_inputs"

設(shè)置 etherlab 的輸出形式。

@:~$ ethercat pdos -a 0 -p 0 -s "etherlab"
%
% Master 0, Slave 0, "2DM522-EC"
%
function rv = slave0()

% Slave configuration

rv.SlaveConfig.vendor = 1717995656;
rv.SlaveConfig.product = hex2dec('20190303');
rv.SlaveConfig.description = '2DM522-EC';
rv.SlaveConfig.sm = { ...
    {0, 0, {
        }}, ...
    {1, 1, {
        }}, ...
    {2, 0, {
        {hex2dec('1600'), [
            hex2dec('6040'), hex2dec('00'),  16; ...
            hex2dec('6060'), hex2dec('00'),   8; ...
            hex2dec('607a'), hex2dec('00'),  32; ...
            hex2dec('60b8'), hex2dec('00'),  16; ...
            hex2dec('60fe'), hex2dec('01'),  32; ...
            hex2dec('60fe'), hex2dec('02'),  32; ...
            ]}, ...
        }}, ...
    {3, 1, {
        {hex2dec('1a00'), [
            hex2dec('603f'), hex2dec('00'),  16; ...
            hex2dec('6041'), hex2dec('00'),  16; ...
            hex2dec('6061'), hex2dec('00'),   8; ...
            hex2dec('6064'), hex2dec('00'),  32; ...
            hex2dec('60b9'), hex2dec('00'),  16; ...
            hex2dec('60ba'), hex2dec('00'),  32; ...
            hex2dec('60bb'), hex2dec('00'),  32; ...
            hex2dec('60bc'), hex2dec('00'),  32; ...
            hex2dec('60bd'), hex2dec('00'),  32; ...
            hex2dec('60fd'), hex2dec('00'),  32; ...
            ]}, ...
        }}, ...
    };

% Port configuration

rv.PortConfig.input(1).pdo = [2, 0, 0, 0];
rv.PortConfig.input(1).pdo_data_type = 1016;

rv.PortConfig.input(2).pdo = [2, 0, 1, 0];
rv.PortConfig.input(2).pdo_data_type = 1008;

rv.PortConfig.input(3).pdo = [2, 0, 2, 0];
rv.PortConfig.input(3).pdo_data_type = 1032;

rv.PortConfig.input(4).pdo = [2, 0, 3, 0];
rv.PortConfig.input(4).pdo_data_type = 1016;

rv.PortConfig.input(5).pdo = [2, 0, 4, 0];
rv.PortConfig.input(5).pdo_data_type = 1032;

rv.PortConfig.input(6).pdo = [2, 0, 5, 0];
rv.PortConfig.input(6).pdo_data_type = 1032;

rv.PortConfig.output(1).pdo = [3, 0, 0, 0];
rv.PortConfig.output(1).pdo_data_type = 1016;

rv.PortConfig.output(2).pdo = [3, 0, 1, 0];
rv.PortConfig.output(2).pdo_data_type = 1016;

rv.PortConfig.output(3).pdo = [3, 0, 2, 0];
rv.PortConfig.output(3).pdo_data_type = 1008;

rv.PortConfig.output(4).pdo = [3, 0, 3, 0];
rv.PortConfig.output(4).pdo_data_type = 1032;

rv.PortConfig.output(5).pdo = [3, 0, 4, 0];
rv.PortConfig.output(5).pdo_data_type = 1016;

rv.PortConfig.output(6).pdo = [3, 0, 5, 0];
rv.PortConfig.output(6).pdo_data_type = 1032;

rv.PortConfig.output(7).pdo = [3, 0, 6, 0];
rv.PortConfig.output(7).pdo_data_type = 1032;

rv.PortConfig.output(8).pdo = [3, 0, 7, 0];
rv.PortConfig.output(8).pdo_data_type = 1032;

rv.PortConfig.output(9).pdo = [3, 0, 8, 0];
rv.PortConfig.output(9).pdo_data_type = 1032;

rv.PortConfig.output(10).pdo = [3, 0, 9, 0];
rv.PortConfig.output(10).pdo_data_type = 1032;

end

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.12 ethercat upload

該命令行用以讀取指定從站相應(yīng)PDO設(shè)定的參數(shù)值。

@:~$ ethercat upload
ethercat upload [OPTIONS] <INDEX> <SUBINDEX>

Read an SDO entry from a slave.

This command requires a single slave to be selected.

The data type of the SDO entry is taken from the SDO
dictionary by default. It can be overridden with the
--type option. If the slave does not support the SDO
information service or the SDO is not in the dictionary,
the --type option is mandatory.

These are valid data types to use with
the --type option:
  bool,
  int8, int16, int32, int64,
  uint8, uint16, uint32, uint64,
  float, double,
  string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
  sm8, sm16, sm32, sm64

Arguments:
  INDEX    is the SDO index and must be an unsigned
           16 bit number.
  SUBINDEX is the SDO entry subindex and must be an
           unsigned 8 bit number.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --type     -t <type>   SDO entry data type (see above).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

必選參數(shù)介紹

  • INDEX:16位無符整型的SDO索引;
  • SUBINDEX:8位無符整型的SDO子索引;

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –type -t <type> : SDO 子索引中的參數(shù)數(shù)據(jù)類型;

例子

@:~$ ethercat upload 0x2001 0x0000
0x03e8 1000

解析:讀取從站0中索引號(hào)為 0x2001(16位),子索引號(hào)為00(8位)的SDO條目。返回的參數(shù)值為 1000。

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.13 ethercat download

該命令行用以向指定的從站 SDO 中的子索引中寫入相應(yīng)的參數(shù)值。

@:~$ ethercat upload
ethercat download [OPTIONS] <INDEX> <SUBINDEX> <VALUE>
 [OPTIONS] <INDEX> <VALUE>

Write an SDO entry to a slave.

This command requires a single slave to be selected.

The data type of the SDO entry is taken from the SDO
dictionary by default. It can be overridden with the
--type option. If the slave does not support the SDO
information service or the SDO is not in the dictionary,
the --type option is mandatory.

The second call (without <SUBINDEX>) uses the complete
access method.

These are valid data types to use with
the --type option:
  bool,
  int8, int16, int32, int64,
  uint8, uint16, uint32, uint64,
  float, double,
  string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
  sm8, sm16, sm32, sm64

Arguments:
  INDEX    is the SDO index and must be an unsigned
           16 bit number.
  SUBINDEX is the SDO entry subindex and must be an
           unsigned 8 bit number.
  VALUE    is the value to download and must correspond
           to the SDO entry datatype (see above). Use
           '-' to read from standard input.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --type     -t <type>   SDO entry data type (see above).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

必選參數(shù)介紹

  • INDEX:16位無符整型的SDO索引;
  • SUBINDEX:8位無符整型的SDO子索引;
  • VALUE: 要設(shè)定的參數(shù),必須符合該SDO子索引要求的數(shù)據(jù)類型參數(shù);

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –type -t <type> : SDO 子索引中的參數(shù)數(shù)據(jù)類型;

例子:

向從站0的索引號(hào)為0x6060(16位),子索引號(hào)為00(8位)的地址寫入?yún)?shù)值"0x08"。

@:~$ sudo ethercat download -t int16 -p 0 0x6060 00 08

有的SDO 可能是由于廠家的限制,不能寫入?yún)?shù)。

@:~$ sudo ethercat download -t uint16 0x2008 0x0000 0x000f
SDO transfer aborted with code 0x08000021: Data cannot be transferred or stored to the application because of local control

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.14 ethercat soe_read

該命令行用以讀取從站的 IDN 參數(shù)值。

@:~$ ethercat soe_read --help
ethercat soe_read [OPTIONS] <IDN>
ethercat soe_read [OPTIONS] <DRIVE> <IDN>

Read an SoE IDN from a slave.

This command requires a single slave to be selected.

Arguments:
  DRIVE    is the drive number (0 - 7). If omitted, 0 is assumed.
  IDN      is the IDN and must be either an unsigned
           16 bit number acc. to IEC 61800-7-204:
             Bit 15: (0) Standard data, (1) Product data
             Bit 14 - 12: Parameter set (0 - 7)
             Bit 11 - 0: Data block number
           or a string like 'P-0-150'.

Data of the given IDN are read and displayed according to
the given datatype, or as raw hex bytes.

These are valid data types to use with
the --type option:
  bool,
  int8, int16, int32, int64,
  uint8, uint16, uint32, uint64,
  float, double,
  string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
  sm8, sm16, sm32, sm64

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --type     -t <type>   Data type (see above).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備

必選參數(shù)介紹

  • DRIVE: 是驅(qū)動(dòng)器編號(hào)(0-7)。如果省略,則假定為0。
  • IDN:必須是無符號(hào)的符合IEC 61800-7-2004的16位數(shù)字。
    • 位15:(0)標(biāo)準(zhǔn)數(shù)據(jù),(1)產(chǎn)品數(shù)據(jù)
    • 位14-12:參數(shù)集(0-7)
    • 位11-0:數(shù)據(jù)塊編號(hào)或類似于“P-0-150”的字符串。

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –type -t <type> : 參數(shù)數(shù)據(jù)類型;

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.15 ethercat soe_write

該命令行用以向指定從站 SOE IDN 寫入一個(gè)參數(shù)值。

@:~$ ethercat soe_write --help
ethercat soe_write [OPTIONS] <IDN> <VALUE>
ethercat soe_write [OPTIONS] <DRIVE> <IDN> <VALUE>

Write an SoE IDN to a slave.

This command requires a single slave to be selected.

Arguments:
  DRIVE    is the drive number (0 - 7). If omitted, 0 is assumed.
  IDN      is the IDN and must be either an unsigned
           16 bit number acc. to IEC 61800-7-204:
             Bit 15: (0) Standard data, (1) Product data
             Bit 14 - 12: Parameter set (0 - 7)
             Bit 11 - 0: Data block number
           or a string like 'P-0-150'.
  VALUE    is the value to write (see below).

The VALUE argument is interpreted as the given data type
(--type is mandatory) and written to the selected slave.

These are valid data types to use with
the --type option:
  bool,
  int8, int16, int32, int64,
  uint8, uint16, uint32, uint64,
  float, double,
  string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
  sm8, sm16, sm32, sm64

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --type     -t <type>   Data type (see above).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備

必選參數(shù)介紹

  • DRIVE: 是驅(qū)動(dòng)器編號(hào)(0-7)。如果省略,則假定為0。
  • IDN:必須是無符號(hào)的符合IEC 61800-7-2004的16位數(shù)字。
    • 位15:(0)標(biāo)準(zhǔn)數(shù)據(jù),(1)產(chǎn)品數(shù)據(jù)
    • 位14-12:參數(shù)集(0-7)
    • 位11-0:數(shù)據(jù)塊編號(hào)或類似于“P-0-150”的字符串。
  • VALUE:要寫入的數(shù)據(jù)。

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –type -t <type> : 參數(shù)數(shù)據(jù)類型;

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.16 ethercat foe_read

通過FOE讀取從站的文件。


@:~$ ethercat foe_read --help
ethercat foe_read [OPTIONS] <SOURCEFILE> [<PASSWORD>]

Read a file from a slave via FoE.

This command requires a single slave to be selected.

Arguments:
  SOURCEFILE is the name of the source file on the slave.
  PASSWORD is the numeric password defined by the vendor.

Command-specific options:
  --output-file -o <file>   Local target filename. If
                            '-' (default), data are
                            printed to stdout.
  --alias       -a <alias>  
  --position    -p <pos>    Slave selection. See the help
                            of the 'slaves' command.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備。

必選參數(shù)介紹

  • SOURCEFILE:為從站中的源文件名字;
  • PASSWORD:廠家定義的數(shù)字密碼;

可選參數(shù)介紹

  • –output -file -o :為讀取數(shù)據(jù)的存儲(chǔ)文件,缺省的話數(shù)據(jù)將會(huì)輸出到終端;
  • –alias:匹配從站的別名;
  • –position:匹配從站的絕對(duì)位置;

2.17 ethercat foe_write

@:~$ ethercat foe_write --help
ethercat foe_write [OPTIONS] <FILENAME> [<PASSWORD>]

Store a file on a slave via FoE.

This command requires a single slave to be selected.

Arguments:
  FILENAME can either be a path to a file, or '-'. In
           the latter case, data are read from stdin and
           the --output-file option has to be specified.
  PASSWORD is the numeric password defined by the vendor.

Command-specific options:
  --output-file -o <file>   Target filename on the slave.
                            If the FILENAME argument is
                            '-', this is mandatory.
                            Otherwise, the basename() of
                            FILENAME is used by default.
  --alias       -a <alias>
  --position    -p <pos>    Slave selection. See the help
                            of the 'slaves' command.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備

必選參數(shù)介紹

  • FILENAME:為要發(fā)送的文件(指定路徑+文件名),也可以為"-",表示從標(biāo)準(zhǔn)輸入中讀取文件;
  • PASSWORD:廠家定義的數(shù)字密碼;

可選參數(shù)介紹

  • –output -file -o :為從站存儲(chǔ)的目標(biāo)文件名,假如不指定名字,則為主站發(fā)送 FILENAME 的去掉路徑的名字;
  • –alias:匹配從站的別名;
  • –position:匹配從站的絕對(duì)位置;

2.18 ethercat reg_read

獲取對(duì)應(yīng)從站寄存器的內(nèi)容。
《工業(yè)以太網(wǎng)現(xiàn)場(chǎng)總線 EtherCAT 驅(qū)動(dòng)程序設(shè)計(jì)及應(yīng)用》里面的<3.1.2 ESC 存儲(chǔ)空間> 提到 ESC 芯片具有 64KB 的DPRAM 地址空間,前 4kB (0x0000 ~ 0x0FFFF) 的空間為寄存器空間。0x1000~0xFFFF 的地址空間為過程數(shù)據(jù)存儲(chǔ)空間。

@:~$ ethercat reg_read --help
ethercat reg_read [OPTIONS] <ADDRESS> [SIZE]

Output a slave's register contents.

This command requires a single slave to be selected.

Arguments:
  ADDRESS is the register address. Must
          be an unsigned 16 bit number.
  SIZE    is the number of bytes to read and must also be
          an unsigned 16 bit number. ADDRESS plus SIZE
          may not exceed 64k. The size is ignored (and
          can be omitted), if a selected data type
          implies a size.

These are valid data types to use with
the --type option:
  bool,
  int8, int16, int32, int64,
  uint8, uint16, uint32, uint64,
  float, double,
  string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
  sm8, sm16, sm32, sm64

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --type     -t <type>   Data type (see above).

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備。

必選參數(shù)介紹

  • ADDRESS:16位無符整型的寄存器地址;
  • SIZE:要讀取的對(duì)應(yīng)寄存器字節(jié)數(shù)(16位無符號(hào)值);[SIZE] + ADDRESS不能超過64K,假如type參數(shù)隱含要讀取的字節(jié)數(shù),則可以忽略掉[SIZE]參數(shù);

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –type -t <type> : 要讀取的參數(shù)數(shù)據(jù)類型;

例子

讀取從站的 SM 通道數(shù)目。

@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x0005
0x08 8

讀取從站的 RAM 容量,過程數(shù)據(jù)存儲(chǔ)區(qū)容量,以 KByte 為單位。當(dāng)前驅(qū)動(dòng)器的容量為 8 KB。

@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x0006
0x08 8

讀取從站的端口配置,當(dāng)前值為 0f,表示支持 MII 的 Port0 和 Port1 兩個(gè)端口。

@:~$ ethercat reg_read -a 0 -p 0 -t uint8 0x0007
0x0f 15

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.19 ethercat reg_write

設(shè)定對(duì)應(yīng)從站寄存器的內(nèi)容。

@:~$ ethercat reg_write --help
ethercat reg_write [OPTIONS] <OFFSET> <DATA>

Write data to a slave's registers.

This command requires a single slave to be selected.

Arguments:
  ADDRESS is the register address to write to.
  DATA    depends on whether a datatype was specified
          with the --type option: If not, DATA must be
          either a path to a file with data to write,
          or '-', which means, that data are read from
          stdin. If a datatype was specified, VALUE is
          interpreted respective to the given type.

These are valid data types to use with
the --type option:
  bool,
  int8, int16, int32, int64,
  uint8, uint16, uint32, uint64,
  float, double,
  string, octet_string, unicode_string.
For sign-and-magnitude coding, use the following types:
  sm8, sm16, sm32, sm64

Command-specific options:
  --alias     -a <alias>
  --position  -p <pos>    Slave selection. See the help of
                          the 'slaves' command.
  --type      -t <type>   Data type (see above).
  --emergency -e          Send as emergency request.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備。

必選參數(shù)介紹

  • ADDRESS:16位無符整型的寄存器地址;
  • DATA:要寫入寄存器的數(shù)據(jù);假如制定了"ype"數(shù)據(jù)類型,那么"DATA"根據(jù)指定的數(shù)據(jù)類型對(duì)數(shù)據(jù)進(jìn)行解析;假如未指定"type"數(shù)據(jù)類型,則"DATA"可以為指定的文件或?qū)?DATA"設(shè)置為"-",表示從標(biāo)準(zhǔn)輸入中獲得數(shù)據(jù);

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –type -t <type> : 要設(shè)置的參數(shù)數(shù)據(jù)類型;
  • –emergency -e:以緊急的方式請(qǐng)求寫入文件;

例子

向從站5的寄存器0x092c(代表系統(tǒng)時(shí)間偏移)寫入數(shù)據(jù)200。

sudo ethercat reg_write -p 5 -t sm32 0x092c 200 

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.20 ethercat sii_read

該命令行用以讀取從站的SII內(nèi)容。

@:~$ ethercat sii_read --help
ethercat sii_read [OPTIONS]

Output a slave's SII contents.

This command requires a single slave to be selected.

Without the --verbose option, binary SII contents are
output.

With the --verbose option given, a textual representation
of the data is output, that is separated by SII category
names.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --verbose  -v          Output textual data with
                         category names.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備。

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –verbose -v : 分類顯示數(shù)據(jù)文本內(nèi)容;

例子:

顯示從站sii的內(nèi)容。

@:~$ ethercat sii_read -a 0 -p 0
<d???ff   ?
$	2DM522-EC	2DM Slave
2DM SlavesDSynchron
                   TxPdoMapping	errorcode
digtal_inputsactual_velocityfollow_err_actualTorque_actual_value_probe_pos1_pos_value?Touch_probe_pos1_neg_value?Touch_probe_pos2_pos_value?Touch_probe_pos2_neg_value
                                                                RxPdoMapping
target_torqueprofile_velocityprofile_accelerationprofile_deceleration  controlwordop_modetarget_positionTouch_probe_functionphysical_outputbit_masktargrt_velocity
                                                                     home_offset
      home_methodhome_switch_velocityhome_zero_velocityhome_acceleration/(?)?&"d 2L?
?`Aa`  d`
 ?`
   ?`
 ?` ?` ?` ??a` l` ?` ???`w`??3l@``z` ?`?` ?`? ?@``?``?` ?`? ?q`?` ?` ?` ?` ?`? ?|`  ?`?`" ?`# ?`$ <??@:~$ 

以分類數(shù)據(jù)文本形式顯示sii的內(nèi)容。

@:~$ ethercat sii_read -a 0 -p 0 -v
SII Area:
  00 3c 00 00 64 00 00 00 00 00 00 00 00 00 91 00
  88 88 66 66 03 03 19 20 20 06 19 20 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  00 10 80 00 00 12 00 01 04 00 00 00 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00 00 0f 00 01 00
SII Category 0x000a (STRINGS), 286 words
  24 09 32 44 4d 35 32 32 2d 45 43 09 32 44 4d 20
  53 6c 61 76 65 0a 32 44 4d 20 53 6c 61 76 65 73
  02 44 43 08 53 79 6e 63 68 72 6f 6e 0c 54 78 50
  64 6f 4d 61 70 70 69 6e 67 09 65 72 72 6f 72 63
  6f 64 65 0a 73 74 61 74 75 73 77 6f 72 64 0f 6f
  70 5f 6d 6f 64 65 5f 64 69 73 70 6c 61 79 0f 61
  63 74 75 61 6c 5f 70 6f 73 69 74 69 6f 6e 12 54
  6f 75 63 68 5f 70 72 6f 62 65 5f 73 74 61 74 75
  73 1a 54 6f 75 63 68 5f 70 72 6f 62 65 5f 70 6f
  73 31 5f 70 6f 73 5f 76 61 6c 75 65 1a 54 6f 75
  63 68 5f 70 72 6f 62 65 5f 70 6f 73 31 5f 6e 65
  67 5f 76 61 6c 75 65 1a 54 6f 75 63 68 5f 70 72
  6f 62 65 5f 70 6f 73 32 5f 70 6f 73 5f 76 61 6c
  75 65 1a 54 6f 75 63 68 5f 70 72 6f 62 65 5f 70
  6f 73 32 5f 6e 65 67 5f 76 61 6c 75 65 0d 64 69
  67 74 61 6c 5f 69 6e 70 75 74 73 0f 61 63 74 75
  61 6c 5f 76 65 6c 6f 63 69 74 79 11 66 6f 6c 6c
  6f 77 5f 65 72 72 5f 61 63 74 75 61 6c 13 54 6f
  72 71 75 65 5f 61 63 74 75 61 6c 5f 76 61 6c 75
  65 0c 52 78 50 64 6f 4d 61 70 70 69 6e 67 0b 63
  6f 6e 74 72 6f 6c 77 6f 72 64 07 6f 70 5f 6d 6f
  64 65 0f 74 61 72 67 65 74 5f 70 6f 73 69 74 69
  6f 6e 14 54 6f 75 63 68 5f 70 72 6f 62 65 5f 66
  75 6e 63 74 69 6f 6e 10 70 68 79 73 69 63 61 6c
  5f 6f 75 74 70 75 74 73 08 62 69 74 5f 6d 61 73
  6b 0f 74 61 72 67 72 74 5f 76 65 6c 6f 63 69 74
  79 0d 74 61 72 67 65 74 5f 74 6f 72 71 75 65 10
  70 72 6f 66 69 6c 65 5f 76 65 6c 6f 63 69 74 79
  14 70 72 6f 66 69 6c 65 5f 61 63 63 65 6c 65 72
  61 74 69 6f 6e 14 70 72 6f 66 69 6c 65 5f 64 65
  63 65 6c 65 72 61 74 69 6f 6e 0b 68 6f 6d 65 5f
  6f 66 66 73 65 74 0b 68 6f 6d 65 5f 6d 65 74 68
  6f 64 14 68 6f 6d 65 5f 73 77 69 74 63 68 5f 76
  65 6c 6f 63 69 74 79 12 68 6f 6d 65 5f 7a 65 72
  6f 5f 76 65 6c 6f 63 69 74 79 11 68 6f 6d 65 5f
  61 63 63 65 6c 65 72 61 74 69 6f 6e
SII Category 0x001e (General), 16 words
  02 00 01 01 01 2f 00 00 00 01 00 04 00 00 03 00
  11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SII Category 0x0028 (FMMU), 2 words
  01 02 03 ff
SII Category 0x0029 (SyncM), 16 words
  00 10 80 00 26 00 01 01 00 12 00 01 22 00 01 02
  00 14 11 00 64 00 01 03 00 16 1f 00 20 00 01 04
SII Category 0x0032 (TXPDO), 76 words
  00 1a 0a 03 00 06 01 00 3f 60 00 07 06 10 00 00
  41 60 00 08 06 10 00 00 61 60 00 09 02 08 00 00
  64 60 00 0a 04 20 00 00 b9 60 00 0b 06 10 00 00
  ba 60 00 0c 04 20 00 00 bb 60 00 0d 04 20 00 00
  bc 60 00 0e 04 20 00 00 bd 60 00 0f 04 20 00 00
  fd 60 00 10 07 20 00 00 01 1a 03 ff 00 06 00 00
  61 60 00 09 02 08 00 00 6c 60 00 11 04 20 00 00
  f4 60 00 12 04 20 00 00 02 1a 02 ff 00 06 00 00
  3f 60 00 07 06 10 00 00 77 60 00 13 03 10 00 00
  03 1a 00 ff 00 06 00 00
SII Category 0x0033 (RXPDO), 108 words
  00 16 06 02 00 14 01 00 40 60 00 15 06 10 00 00
  60 60 00 16 02 08 00 00 7a 60 00 17 04 20 00 00
  b8 60 00 18 06 10 00 00 fe 60 01 19 07 20 00 00
  fe 60 02 1a 07 20 00 00 01 16 06 ff 00 14 00 00
  40 60 00 15 06 10 00 00 60 60 00 16 02 08 00 00
  ff 60 00 1b 04 20 00 00 b8 60 00 18 06 10 00 00
  fe 60 01 19 07 20 00 00 fe 60 02 1a 07 20 00 00
  02 16 06 ff 00 14 00 00 71 60 00 1c 03 10 00 00
  81 60 00 1d 07 20 00 00 83 60 00 1e 07 20 00 00
  84 60 00 1f 07 20 00 00 fe 60 01 19 07 20 00 00
  fe 60 02 1a 07 20 00 00 03 16 05 ff 00 14 00 00
  7c 60 00 20 04 20 00 00 98 60 00 21 02 08 00 00
  99 60 01 22 04 20 00 00 99 60 02 23 04 20 00 00
  9a 60 00 24 07 20 00 00
SII Category 0x003c (DC), 24 words
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
  01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00
  00 00 00 00 00 00 00 00 01 00 05 00 00 00 00 00

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.21 ethercat sii_write

該命令行用以設(shè)置從站的SII內(nèi)容。

@:~$ ethercat sii_write --help
ethercat sii_write [OPTIONS] <FILENAME>

Write SII contents to a slave.

This command requires a single slave to be selected.

The file contents are checked for validity and integrity.
These checks can be overridden with the --force option.

Arguments:
  FILENAME must be a path to a file that contains a
           positive number of words. If it is '-',
           data are read from stdin.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.
  --force    -f          Override validity checks.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備。

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –verbose -v : 分類顯示數(shù)據(jù)文本內(nèi)容;

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.22 ethercat data

該命令行以二進(jìn)制的形式顯示所有過程數(shù)據(jù)。


ethercat data [OPTIONS]

Output binary domain process data.

Data of multiple domains are concatenated.

Command-specific options:
  --domain -d <index>  Positive numerical domain index.
                       If omitted, data of all domains
                       are output.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

可選參數(shù)介紹

  • –domain -d <index>:域的索引值,假如不填寫參數(shù)則顯示所有過程數(shù)據(jù);
@:~$ ethercat data 
7

注意:必須運(yùn)行應(yīng)用程序才可以使用。

2.23 ethercat config

該命令行用來顯示從站的配置。


@:~$ ethercat config --help
ethercat config [OPTIONS]

Show slave configurations.

Without the --verbose option, slave configurations are
output one-per-line. Example:

1001:0  0x0000003b/0x02010000  3  OP
|       |                      |  |
|       |                      |  \- Application-layer
|       |                      |     state of the attached
|       |                      |     slave, or '-', if no
|       |                      |     slave is attached.
|       |                      \- Absolute decimal ring
|       |                         position of the attached
|       |                         slave, or '-' if none
|       |                         attached.
|       \- Expected vendor ID and product code (both
|          hexadecimal).
\- Alias address and relative position (both decimal).

With the --verbose option given, the configured PDOs and
SDOs are output in addition.

Configuration selection:
  Slave configurations can be selected with
  the --alias and --position parameters as follows:

  1) If neither the --alias nor the --position option
     is given, all slave configurations are displayed.
  2) If only the --position option is given, an alias
     of zero is assumed (see 4)).
  3) If only the --alias option is given, all slave
     configurations with the given alias address
     are displayed.
  4) If both the --alias and the --position option are
     given, the selection can match a single
     configuration, that is displayed, if it exists.

Command-specific options:
  --alias    -a <alias>  Configuration alias (see above).
  --position -p <pos>    Relative position (see above).
  --verbose  -v          Show detailed configurations.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;
  • –verbose -v : 顯示詳細(xì)的配置信息;

例子:

顯示從站的配置信息和狀態(tài)。

@:~$ ethercat config
0:0  0x66668888/0x20190303  0  OP  

下面這個(gè)例子采用 -v 參數(shù)用來顯示更加詳細(xì)的配置信息。

@:~$ ethercat config -a 0 -p 0 -v
Alias: 0
Position: 0
Vendor Id: 0x66668888
Product code: 0x20190303
Attached slave: 0 (OP)
Watchdog divider: (Default)
Watchdog intervals: (Default)
SM2, Dir: Output, Watchdog: Enable
  PDO 0x1600
    PDO entry 0x6040:00, 16 bit
    PDO entry 0x607b:00,  8 bit
    PDO entry 0x6060:00,  8 bit
    PDO entry 0x607a:00, 32 bit
SM3, Dir: Input, Watchdog: Enable
  PDO 0x1a00
    PDO entry 0x6041:00, 16 bit
    PDO entry 0x606c:00, 32 bit
    PDO entry 0x6064:00, 32 bit
SDO configuration:
  None.
IDN configuration:
  None.
Feature flags:
  None.
DC configuration:
  AssignActivate: 0x0300
         Cycle [ns]   Shift [ns]
  SYNC0      1000000            0
  SYNC1            0            0

注意:必須運(yùn)行應(yīng)用程序才可以使用。

2.24 ethercat domains

該命令行用來顯示域的信息。

@:~$ ethercat domains --help
ethercat domains [OPTIONS]

Show configured domains.

Without the --verbose option, the domains are displayed
one-per-line. Example:

Domain0: LogBaseAddr 0x00000000, Size   6, WorkingCounter 0/1

The domain's base address for the logical datagram
(LRD/LWR/LRW) is displayed followed by the domain's
process data size in byte. The last values are the current
datagram working counter sum and the expected working
counter sum. If the values are equal, all PDOs were
exchanged during the last cycle.

If the --verbose option is given, the participating slave
configurations/FMMUs and the current process data are
additionally displayed:

Domain1: LogBaseAddr 0x00000006, Size   6, WorkingCounter 0/1
  SlaveConfig 1001:0, SM3 ( Input), LogAddr 0x00000006, Size 6
    00 00 00 00 00 00

The process data are displayed as hexadecimal bytes.

Command-specific options:
  --domain  -d <index>  Positive numerical domain index.
                        If omitted, all domains are
                        displayed.

  --verbose -v          Show FMMUs and process data
                        in addition.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

可選參數(shù)介紹

  • –domain -d <index>:域的索引號(hào),為正整數(shù)。如果沒有填寫該值則顯示所有的域;
  • –verbose -v : 顯示域的詳細(xì)信息(FMMU和過程數(shù)據(jù)的信息);

例子

@:~$ ethercat domains 
Domain0: LogBaseAddr 0x00000000, Size  18, WorkingCounter 3/3

結(jié)果說明:

  • LogBaseAddr:邏輯尋址的邏輯基地址;
  • Size:域交換數(shù)據(jù)的字節(jié)數(shù);
  • WorkingCounter:第一個(gè)數(shù)字是WKC的當(dāng)前值,第二個(gè)數(shù)字是WKC的期望值;

設(shè)置 -v 參數(shù)后顯示的結(jié)果。

@:~$ ethercat domains -v
Domain0: LogBaseAddr 0x00000000, Size  18, WorkingCounter 3/3
  SlaveConfig 0:0, SM2 (Output), LogAddr 0x00000000, Size 8
    1f 00 00 08 0a 00 00 00 
  SlaveConfig 0:0, SM3 ( Input), LogAddr 0x00000008, Size 10
    37 02 00 00 00 00 00 00 00 00 

結(jié)果說明:

  • SlaveConfig:從機(jī)配置信息,主要包含別名和地址(絕對(duì)地址或相對(duì)地址);
  • SM2:同步管理器2;
  • LogAddr:FMMU映射的地址;
  • Size:映射地址的大??;
  • 數(shù)據(jù)位:十六進(jìn)制顯示的過程數(shù)據(jù);

注意:必須運(yùn)行應(yīng)用程序才可以使用。

2.25 ethercat crc

該命令行用以 CRC 錯(cuò)誤診斷。

@:~$ ethercat crc --help
ethercat crc
ethercat crc reset

CRC error register diagnosis.

CRC - CRC Error Counter                0x300, 0x302, 0x304, 0x306
PHY - Physical Interface Error Counter 0x301, 0x303, 0x305, 0x307
FWD - Forwarded RX Error Counter       0x308, 0x309, 0x30a, 0x30b
NXT - Next slave

例子:

@:~$ ethercat crc
   |Port 0         |Port 1         |Port 2         |Port 3         |
   |CRC PHY FWD NXT|CRC PHY FWD NXT|CRC PHY FWD NXT|CRC PHY FWD NXT|
  0|  0   0   0    |               |               |               |2DM522-EC

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.26 ethercat rescan

該命令行用以重新掃描總線上的從站信息。

@:~$ ethercat rescan --help
ethercat rescan

Rescan the bus.

Command a bus rescan. Gathered slave information will be
forgotten and slaves will be read in again.

例子:

該命令執(zhí)行后不會(huì)有任何信息輸出。

@:~$ ethercat rescan 

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

2.27 ethercat cstruct

該命令行生成的PDO信息可以直接被應(yīng)用層的ecrt_slave_config_pdos()函數(shù)調(diào)用。

@:~$ ethercat cstruct --help
ethercat cstruct [OPTIONS]

Generate slave PDO information in C language.

The output C code can be used directly with the
ecrt_slave_config_pdos() function of the application
interface.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;

例子

@:~$ ethercat cstruct -a 0 -p 0
/* Master 0, Slave 0, "2DM522-EC"
 * Vendor ID:       0x66668888
 * Product code:    0x20190303
 * Revision number: 0x20190620
 */

ec_pdo_entry_info_t slave_0_pdo_entries[] = {
    {0x6040, 0x00, 16}, /* controlword */
    {0x6060, 0x00, 8}, /* op_mode */
    {0x607a, 0x00, 32}, /* target_position */
    {0x60b8, 0x00, 16}, /* Touch_probe_function */
    {0x60fe, 0x01, 32}, /* physical_outputs */
    {0x60fe, 0x02, 32}, /* bit_mask */
    {0x603f, 0x00, 16}, /* errorcode */
    {0x6041, 0x00, 16}, /* statusword */
    {0x6061, 0x00, 8}, /* op_mode_display */
    {0x6064, 0x00, 32}, /* actual_position */
    {0x60b9, 0x00, 16}, /* Touch_probe_status */
    {0x60ba, 0x00, 32}, /* Touch_probe_pos1_pos_value */
    {0x60bb, 0x00, 32}, /* Touch_probe_pos1_neg_value */
    {0x60bc, 0x00, 32}, /* Touch_probe_pos2_pos_value */
    {0x60bd, 0x00, 32}, /* Touch_probe_pos2_neg_value */
    {0x60fd, 0x00, 32}, /* digtal_inputs */
};

ec_pdo_info_t slave_0_pdos[] = {
    {0x1600, 6, slave_0_pdo_entries + 0}, /* RxPdoMapping */
    {0x1a00, 10, slave_0_pdo_entries + 6}, /* TxPdoMapping */
};

ec_sync_info_t slave_0_syncs[] = {
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {2, EC_DIR_OUTPUT, 1, slave_0_pdos + 0, EC_WD_ENABLE},
    {3, EC_DIR_INPUT, 1, slave_0_pdos + 1, EC_WD_DISABLE},
    {0xff}
};

注意:必須運(yùn)行應(yīng)用程序才可以使用。

sudo ethercat cstruct -a 0
記下電機(jī)VenderID,ProductID,PDO信息

2.28 ethercat eoe

該命令行用以顯示EOE的統(tǒng)計(jì)信息,包括主站的發(fā)送率和接收率(Byte/s)。

@:~$ ethercat eoe --help
ethercat eoe

Display Ethernet over EtherCAT statictics.

The TxRate and RxRate are displayed in Byte/s.

注意:必須運(yùn)行應(yīng)用程序才可以使用。

2.29 ethercat ip

設(shè)置 EOE 的 IP 參數(shù)地址。

@:~$ ethercat ip --help
ethercat ip [OPTIONS] <ARGS>

Set EoE IP parameters.

This command requires a single slave to be selected.

IP parameters can be appended as argument pairs:

  addr <IPv4>[/prefix]  IP address (optionally with
                        decimal subnet prefix)
  link <MAC>            Link-layer address (may contain
                        colons or hyphens)
  default <IPv4>        Default gateway
  dns <IPv4>            DNS server
  name <hostname>       Host name (max. 32 byte)

IPv4 adresses can be given either in dot notation or as
hostnames, which will be automatically resolved.

Command-specific options:
  --alias    -a <alias>
  --position -p <pos>    Slave selection. See the help of
                         the 'slaves' command.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

此命令要求必須指定單個(gè)從屬設(shè)備。

必選參數(shù)介紹

IP參數(shù)可以作為參數(shù)元組添加:

  • addr <IPv4> [/prefix]: IP地址(可選十進(jìn)制子網(wǎng)前綴);
  • link <MAC>: 鏈路層地址(可能包含colons or hyphens);
  • default <IPv4>: 默認(rèn)網(wǎng)關(guān);
  • dns <IPv4>: dns服務(wù)器;
  • name <hostname>: 主機(jī)名(最大32字節(jié));

IPv4地址可以用點(diǎn)表示法,比如說"192.168.0.1"或主機(jī)名,該命令行將會(huì)自動(dòng)解析。

可選參數(shù)介紹

  • –alias -a <alias>:匹配從站的別名;
  • –position -p <pos>:匹配從站的絕對(duì)位置;

注意:必須有從站連接才能使用此命令,不運(yùn)行應(yīng)用程序也可以使用。

到了這里,關(guān)于EtherCAT IGH 命令行介紹的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • RK最強(qiáng)ARM系列之RK3588+AI+Ethercat(linux +xenomai+igh)實(shí)時(shí)解決方案

    RK最強(qiáng)ARM系列之RK3588+AI+Ethercat(linux +xenomai+igh)實(shí)時(shí)解決方案

    RK3588是瑞芯微新一代旗艦級(jí)高端處理器,具有高算力、低功耗、超強(qiáng)多媒體、豐富數(shù)據(jù)接口等特點(diǎn)。搭載四核A76+四核A55的八核CPU和ARM G610MP4 GPU,內(nèi)置6.0TOPs算力的NPU。 有五大技術(shù)優(yōu)勢(shì) 1. 內(nèi)置多種功能強(qiáng)大的嵌入式硬件引擎,支持8K@60fps 的 H.265 和 VP9 解碼器、8K@30fps 的 H.264 解

    2024年02月15日
    瀏覽(70)
  • Go開始:Go基本元素介紹

    Go開始:Go基本元素介紹

    本文深入探討了Go編程語(yǔ)言中的核心概念,包括標(biāo)識(shí)符、、具名函數(shù)、具名值、定義類型、類型別名、包和模塊管理,以及代碼塊和斷行。這些元素是構(gòu)成Go程序的基礎(chǔ),也是編寫高質(zhì)量代碼的關(guān)鍵。 關(guān)注TechLeadCloud,分享互聯(lián)網(wǎng)架構(gòu)、云服務(wù)技術(shù)的全維度知識(shí)。作者擁

    2024年02月10日
    瀏覽(24)
  • TenSEAL庫(kù)介紹:如何開始同態(tài)加密

    TenSEAL庫(kù)介紹:如何開始同態(tài)加密

    TensSEAL是一個(gè)python的第三方庫(kù),是一個(gè)方便的同態(tài)加密庫(kù)。他并不是一個(gè)原生庫(kù),而是Microsoft SEAL(一個(gè)C++庫(kù))的python接口。實(shí)現(xiàn)了BFV和CKKS兩種同態(tài)加密算法,可以直接對(duì)tensor進(jìn)行加密,隱藏了很多具體細(xì)節(jié),可以很容易上手編寫同態(tài)加密的代碼。是一款新手友好性的同態(tài)加

    2023年04月25日
    瀏覽(18)
  • 從零開始的Servlet學(xué)習(xí)介紹

    Servlet是用于Java平臺(tái)上進(jìn)行Web開發(fā)的一種技術(shù),它可以接收和響應(yīng)HTTP請(qǐng)求,并通過動(dòng)態(tài)生成HTML、XML或其他格式的文檔以動(dòng)態(tài)地創(chuàng)建Web內(nèi)容。這篇文章將探討Servlet的概念、工作原理以及如何使用它來構(gòu)建強(qiáng)大的Web應(yīng)用程序。 Servlet是一種Java編程語(yǔ)言的API,它可以接收并處理在

    2024年02月03日
    瀏覽(19)
  • IGH主站通信測(cè)試csp模式(DC同步 preemrt)連通一從站并實(shí)現(xiàn)控制

    IGH主站通信測(cè)試csp模式(DC同步 preemrt)連通一從站并實(shí)現(xiàn)控制

    linuxcnc配置基礎(chǔ)機(jī)器人控制LinuxCNC與EtherCAT介紹PDOSDO,搭建環(huán)境步驟 需要配置IGH主站的查看這篇文章 linux系統(tǒng)學(xué)習(xí)筆記7——一次性安裝igh-ethercat主站 CSP模式 DC同步方式 preemrt實(shí)時(shí)補(bǔ)丁 直接上代碼,這部分是直接控制使用csp模式控制一個(gè)從站運(yùn)動(dòng) 使能后直接運(yùn)動(dòng),10s,每秒60

    2024年01月16日
    瀏覽(37)
  • ETHERCAT轉(zhuǎn)ETHERCAT網(wǎng)關(guān)西門子為什么不支持ethercat兩個(gè)ETHERCAT設(shè)備互聯(lián)

    ETHERCAT轉(zhuǎn)ETHERCAT網(wǎng)關(guān)西門子為什么不支持ethercat兩個(gè)ETHERCAT設(shè)備互聯(lián)

    1.1 產(chǎn)品功能 遠(yuǎn)創(chuàng)智控YC-ECT-ECT是自主研發(fā)的一款ETHERCAT從站功能的通訊網(wǎng)關(guān)。該產(chǎn)品主要功能是將2個(gè)ETHERCAT網(wǎng)絡(luò)連接起來。 本網(wǎng)關(guān)連接到ETHERCAT總線中做為從站使用。 1.2 技術(shù)參數(shù) 1.2.1 遠(yuǎn)創(chuàng)智控YC-ECT-ECT技術(shù)參數(shù) ● 網(wǎng)關(guān)做為ETHERCAT網(wǎng)絡(luò)的從站,可以連接倍福、歐姆龍、基恩士等

    2024年02月16日
    瀏覽(17)
  • 【從零開始學(xué)習(xí)JAVA | 第十八篇】接口介紹

    【從零開始學(xué)習(xí)JAVA | 第十八篇】接口介紹

    目錄 前言: 接口: 如何定義一個(gè)接口: 如何使用一個(gè)接口: 接口中成員的特點(diǎn): 接口與類的區(qū)別:?? 接口的應(yīng)用: 總結(jié): ????????接口其實(shí)是為了彌補(bǔ)繼承的缺點(diǎn): 我們無法讓父類完美的適應(yīng)每一個(gè)子類的要求 。 例如我們有一個(gè)動(dòng)物類的父類,有一個(gè)蝌蚪類,魚

    2024年02月10日
    瀏覽(21)
  • 【從零開始學(xué)習(xí)CSS | 第一篇】選擇器介紹

    【從零開始學(xué)習(xí)CSS | 第一篇】選擇器介紹

    目錄 前言: 選擇器介紹: 各類選擇器: ?總結(jié): ????????本文以及后續(xù)幾篇文章我們將會(huì)集中介紹CSS中的常見選擇器,選擇器的出現(xiàn)可以讓我們實(shí)現(xiàn)對(duì)具體的元素標(biāo)簽進(jìn)行定制,因此我們要掌握好各類選擇器的使用。 ????????在CSS(層疊樣式表)中, 選擇器 是一

    2024年02月15日
    瀏覽(19)
  • 【如何從零基礎(chǔ)小白開始學(xué)習(xí)C++詳細(xì)介紹】

    如果你想從零基礎(chǔ)開始學(xué)習(xí)C++并最終成為一個(gè)“大佬”級(jí)別的專家,你需要遵循一個(gè)階段性的學(xué)習(xí)計(jì)劃,并且不斷練習(xí)和深入研究,下面是學(xué)習(xí)方向的學(xué)習(xí)階段 學(xué)習(xí)編程基礎(chǔ) 了解編程的基本概念,如變量、數(shù)據(jù)類型、運(yùn)算符、控制結(jié)構(gòu)(循環(huán)、條件判斷)、函數(shù)等。 安裝開

    2024年02月20日
    瀏覽(29)
  • 【從零開始學(xué)習(xí)JAVA | 第三十一篇】異常體系介紹

    【從零開始學(xué)習(xí)JAVA | 第三十一篇】異常體系介紹

    ? ? ? ? 本文我們將為大家介紹一下異常的整個(gè)體系,而我們學(xué)習(xí)異常,不是為了敲代碼的時(shí)候不出異常,而是為了能夠熟練的處理異常,如何解決代碼中的異常。 ?我們就以這張圖作為線索來詳細(xì)介紹一下Java中的異常: 在Java中, Exception(異常)是一種表示非致命錯(cuò)誤或異

    2024年02月15日
    瀏覽(90)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包