[教程]
我們很高興分享全新的技術入門指南,協助工程師與系統整合商開始使用 QEC-M-01(EtherCAT MDevice),並搭配 SANYO DENKI SANMOTION G 伺服放大器(EtherCAT),實現即時且高效能的運動控制。

這些指南提供了逐步設定流程、實用的編碼範例和整合技巧,涵蓋了CiA 402 CSP(循環同步位置)和PP(輪廓位置)模式,因此您可以加快啟動速度並減少工程時間。
1. 新指南亮點
QEC-M-01 是一款小巧且強大的 EtherCAT MDevice,配備即時多工架構與整合式開發工具。透過開源的 86Duino IDE,它為自動化應用提供簡單且強大的開發平台。
當搭配 SANMOTION G 伺服系列產品,並在 CiA402 CSP 與 PP 模式下運作時,它可在嚴苛的運動控制系統中實現精準且快速響應的控制。

1.1 SANMOTION G(為什麼選擇 SANMOTION G?)
SANMOTION G 專為小型、輕量化與節能的 AC 伺服應用而設計,可實現高速/高精度控制,並提升生產效率與加工品質。
主要特色亮點:
- 透過新開發的電流控制技術,速度頻率響應最高可達 3.5 kHz(約為傳統機型的 1.6 倍)。
- 透過摩擦與重力偵測及補償,縮短定位穩定時間(5.5 ms,約為傳統機型的 1/3)。
- 馬達最高轉速提升至 6500 min⁻¹(由 6000 min⁻¹ 提升),並擴大輸出範圍。
- 高解析度編碼器:標準為 23-bit,選配最高可達 27-bit,實現高精度與穩定定位。
- 可靠性與維護性提升:支援煞車剩餘壽命估算、突波電流限制最佳化、電力監測,以及 EtherCAT 通訊品質診斷。

對於 EtherCAT 使用者,SANMOTION G 提供 EtherCAT 介面伺服放大器(例如:2 軸型號列示 Interface = EtherCAT)。如需詳細資訊,請參考 SANMOTION G 系列。
1.2 Start Guide 的優勢
- 逐步設定指南:
配線、EtherCAT 網路啟動,以及建議參數檢查清單。 - 程式範例(CSP/PP):
實用程式碼片段與控制流程範例,協助您快速實現運動控制。 - 整合技巧與疑難排解:
常見現場問題的注意事項(驅動器啟用順序、警報處理、EtherCAT 品質檢查等)。

2. 開始使用 QEC-M-01 搭配 SANMOTION G AC Servo
無論您是初學者還是專業開發者,我們的指南都能提供您所需的支援,協助您順利開始使用 QEC-M-01 與 SANMOTION G AC Servo。以下提供兩個範例程式,分別展示 PP 模式與 CSP 模式。
2.1 點對點位置(PP)模式
以下程式將 GADSA01AH24 設定為 CiA402 Profile Position(PP)模式:
- EtherCAT 週期時間:1 毫秒。
- EtherCAT 模式: ECAT_SYNC。
這個 EthercatMaster 物件 ("mdevice”) 代表 QEC-M-01,而 EthercatDevice_CiA402 物件 ("motor”) 代表 GADSA01AH24 驅動器。
範例程式碼如下:
#include "Ethercat.h"
EthercatMaster master;
EthercatDevice_CiA402 motor;
int pp_state = 0;
void setup() {
Serial.begin(115200);
Serial.print("Begin: ");
Serial.println(master.begin());
Serial.print("Slave: ");
Serial.println(motor.attach(0, master));
motor.setCiA402Mode(CIA402_PP_MODE);
// No PDO mapping by default, needs to be filled out by users.
// RxPDO mapping configuration.
motor.sdoDownload8(0x1C12, 0x00, 0);
motor.sdoDownload8(0x1601, 0x00, 0);
motor.sdoDownload32(0x1601, 0x01, 0x60400010);
motor.sdoDownload32(0x1601, 0x02, 0x607A0020);
motor.sdoDownload8(0x1601, 0x00, 2);
motor.sdoDownload16(0x1C12, 0x01, 0x1601);
motor.sdoDownload8(0x1C12, 0x00, 1);
// TxPDO mapping configuration.
motor.sdoDownload8(0x1C13, 0x00, 0);
motor.sdoDownload8(0x1A01, 0x00, 0);
motor.sdoDownload32(0x1A01, 0x01, 0x60410010);
motor.sdoDownload32(0x1A01, 0x02, 0x60640020);
motor.sdoDownload8(0x1A01, 0x00, 2);
motor.sdoDownload16(0x1C13, 0x01, 0x1A01);
motor.sdoDownload8(0x1C13, 0x00, 1);
Serial.print("Start: ");
Serial.println(master.start(1000000, ECAT_SYNC));
Serial.print("Enable: ");
Serial.println(motor.enable());
motor.pp_SetMotionProfileType(0); // Linear ramp (trapezoidal profile)
motor.pp_SetVelocity(100000000);
motor.pp_SetAcceleration(50000000);
motor.pp_SetDeceleration(50000000);
}
void loop() {
Serial.print("Pos: ");
Serial.println(motor.getPositionActualValue());
switch (pp_state)
{
case 0:
if (motor.pp_Run(1000000000) == 0)
pp_state++;
break;
case 1:
if (motor.pp_IsTargetReached())
pp_state++;
break;
case 2:
if (motor.pp_Run(-1000000000) == 0)
pp_state++;
break;
case 3:
if (motor.pp_IsTargetReached())
pp_state = 0;
break;
}
}2.2 Cyclic Synchronous Position(CSP)模式
以下程式將 GADSA01AH24 設定為 CiA402 Cyclic-Synchronous Position(CSP)模式:
- EtherCAT 週期時間:1 毫秒。
- EtherCAT 模式: ECAT_SYNC。
- 運動命令是在 1 ms 的週期性 callback 中產生,透過以固定速率(定速)遞增或遞減命令位置來實現。
這個 EthercatMaster 物件 ("master”) 代表 QEC-M-01,而 EthercatDevice_CiA402 物件 ("motor”) 代表 GADSA01AH24 驅動器。
範例程式碼如下:
#include "Ethercat.h"
EthercatMaster master;
EthercatDevice_CiA402 motor;
int32_t position = 0;
void MyCyclicCallback() {
if (motor.getCiA402State() != CIA402_OPERATION_ENABLED)
return;
motor.setTargetPosition(position += 10000);
}
void setup() {
Serial.begin(115200);
Serial.print("Begin: ");
Serial.println(master.begin());
Serial.print("Slave: ");
Serial.println(motor.attach(0, master));
motor.setDc(1000000);
motor.setCiA402Mode(CIA402_CSP_MODE);
// No PDO mapping by default, needs to be filled out by users.
// RxPDO mapping configuration.
motor.sdoDownload8(0x1C12, 0x00, 0);
motor.sdoDownload8(0x1601, 0x00, 0);
motor.sdoDownload32(0x1601, 0x01, 0x60400010);
motor.sdoDownload32(0x1601, 0x02, 0x607A0020);
motor.sdoDownload8(0x1601, 0x00, 2);
motor.sdoDownload16(0x1C12, 0x01, 0x1601);
motor.sdoDownload8(0x1C12, 0x00, 1);
// TxPDO mapping configuration.
motor.sdoDownload8(0x1C13, 0x00, 0);
motor.sdoDownload8(0x1A01, 0x00, 0);
motor.sdoDownload32(0x1A01, 0x01, 0x60410010);
motor.sdoDownload32(0x1A01, 0x02, 0x60640020);
motor.sdoDownload8(0x1A01, 0x00, 2);
motor.sdoDownload16(0x1C13, 0x01, 0x1A01);
motor.sdoDownload8(0x1C13, 0x00, 1);
master.attachCyclicCallback(MyCyclicCallback);
Serial.print("Start: ");
Serial.println(master.start(1000000, ECAT_SYNC));
motor.setTargetPosition(position = motor.getPositionActualValue());
Serial.print("Enable: ");
Serial.println(motor.enable());
}
void loop() {
Serial.print("Pos: ");
Serial.println(motor.getPositionActualValue());
delay(1000);
}如需進一步了解,請點擊以下連結查看完整指南:
- CSP 模式:
- PP 模式:
我們將持續提供穩定且創新的 EtherCAT 自動化平台,打造更智慧、更快速且更高效率的控制系統。我們誠摯邀請合作夥伴與開發者探索 QEC 解決方案,應用於您的下一個創新自動化專案。
如需更多資訊或樣品申請,請寄信至 info@icop.com.tw、致電最近的 ICOP 分支機構,或聯絡我們的全球官方經銷商。