[QEC教程]
本指南將向您展示如何使用EtherCAT主站 QEC-M-01P 和數位 I/O 從站 QEC-RXXDXX系列.
注意事項:QEC 的 PoE(乙太網路供電)
In QEC product installations, users can easily distinguish between PoE and non-PoE: if the RJ45 house is red, it is PoE type, and if it is black, it is non-PoE type.
非PoE型 | PoE型 |
---|---|
![]() | ![]() |
PoE(乙太網路供電)是一種透過網路供電的功能。 QEC 可配備選購的 PoE 功能以減少佈線。 在實際應用中,PoE是根據系統設備來選擇的,因此在評估和測試時請注意以下幾點:
- QEC 的 PoE 功能與 EtherCAT P 不同且不相容,且 QEC 的 PoE 功能基於 PoE Type B,接腳功能如下:
- 連接 PoE 和非 PoE 設備時,請確保斷開引腳 4、5、7 和 8 處的乙太網路電纜(例如,支援 PoE 的 QEC EtherCAT 主站與第三方 EtherCAT 從站連接時)。
- QEC 的 PoE 最多可傳輸24V/3A 的電源。
1. 連接及接線硬體
這裡使用以下設備:
- QEC-M-01P (EtherCAT 主站/PoE)
- QEC-R11D88H-N (EtherCAT 從站8-ch 數位輸入與8-ch 數位輸出/PoE)
- 24V 電源
- 24V LED

1.1 QEC-M-01P
帶有PoE 功能的QEC EtherCAT 主站。
- 使用 EtherCAT Out 連接埠(上)透過 RJ45 電纜(由 PoE 供電)連接到 QEC-R11D88H 的 EtherCAT In 連接埠。
- 透過 EU 端子連接到 Vs+/Vs- 和 Vp+/Vp- 電源以獲得 24V 電源。

1.2 QEC-R11D88H-N
- 從 VP+ 連接到麵包板++;從 VP 連接到麵包板 。
- 將麵包板 連到按鈕後,再連接到QEC-R11D88H 的數位輸入引腳0+0+,將QEC-R11D88H 的數位輸入引腳0 連回到麵包板 。
- 從麵包板 連接到 QEC-R11D88H 的數位輸出腳位0+ 。
- 將 24V LED+ 端子連接到DO 0-。
- 將 24V LED- 端連接至麵包板 -。
1.3 Wiring Diagram

2. 軟體/開發環境:86Duino IDE
從以下位置下載 86duino IDE: https://www.qec.tw/zh/software/.

After downloading, please unzip the downloaded zip file. No additional software installation is required; just double-click 86duino.exe to start the IDE.

86Duino Coding IDE 500+ 如下圖所示。

3.連接PC並設定環境
請依照以下步驟設定環境:
- 透過 Micro USB 轉 USB 線將 QEC-M-01P 連接至 PC(已安裝 86Duino IDE)。
- 開啟 QEC 電源。
- 開啟電腦中的 “裝置管理員”(按Win+X後在選單中選擇)-> “連接埠(COM & LPT)”,展開連接埠; 您應該看到偵測到 “Prolific PL2303GC USB 串列 COM 連接埠 (COMx)”; 如果沒有,您將需要安裝所需的驅動程式。
(對於Windows PL2303驅動程序,您可以下載於: 這裡)

- 打開86Duino IDE。
- Select the correct board: In the IDE’s menu, select Tools> Board > QEC-M-01 (or the QEC-M master model you use).
- Select Port: In the IDE’s menu, select Tools > Port and select the USB port to connect to the QEC-M master (in this case, COM3 (QEC)).


4. Use 86EVA and ArduBlock
This example shows how to operate the QEC-M (EtherCAT Master) and QEC’s EtherCAT Slave Digital Input & Output Modules through the 86Duino IDE’s graphical low-code programming tools, 86EVA and ArduBlock. Read the pin 0 of Digital Input and judge its status. If it’s HIGH, then set the pin0 of Digital Output to HIGH; if it’s LOW, then set the pin0 of Digital Output to LOW. We connect an external button to DI pin0 and an external 24V LED to DO pin0.
Software Tools Description:
- 86EVA (EVA, EtherCAT-Based Virtual Arduino):
是基於 86Duino IDE 中 EtherCAT Library 的圖形化 EtherCAT 組態工具,是 86Duino 的開發套件之一。 - ArduBlock:
是用於程式設計和IO控制的圖形介面。 它是屬於Arduino IDE的第三方軟體,由上海創作者David Li開發,必須附加到IDE上才能運作。 ArduBlock是一款將圖形塊轉換為程式碼並最終產生主程式到86Duino Coding IDE,然後編譯並上傳的軟體。
步驟1:開啟86EVA,並進行掃描
可透過以下按鈕打開86EVA 工具。

確認選擇了正確的COM port 後,按下「Connect 」 按鈕開始掃描EtherCAT 網路。

完成對EtherCAT 網路上已連接設備的掃描後,將顯示已連接的設備。
按左下角的「View 」按鈕可以查看裝置的狀態。

步驟2:設定參數
在掃描完成的設備圖像上按兩下進入相應的參數設定畫面。
QEC-M-01
按兩下QEC M 01 的圖像以查看參數設定。
如果第一次開發,請先使用預設設置;點擊左上角「Back 」返回。

QEC-R11D88H-N
按兩下QEC R11D88H 的圖像以查看參數設定。

繼續向下操作到 ”Digital Input Pin Mapping” 區塊。其中,我們將 ”Digital Input Pin Mapping” 的 DI00 的下拉框中選擇 “Virtual Pin D0”。

繼續向下操作到 ”Digital Output Pin Mapping” 區塊。其中,我們將 ”Digital Output Pin Mapping” 的 DQ00 的下拉框中選擇 “Virtual Pin D1”。

完成後,點擊左上角「Back」返回。

此動作是將QEC-R11D88H的Digital Input Pin0設置成EVA的虛擬D0腳位;Digital Output Pin0設置成EVA的虛擬D1腳位。
步驟3:生成程式碼
設定完設備的參數後,回到主畫面,並按下右下角的「Code Generation 」按鈕。

完成後,按兩下確定按鈕或10 秒後自動關閉 86EVA 。

生成的程式碼及檔案如下:
- sketch_oct04a:主專案 (.ino,取決於您的專案名稱)
- ChatGPT.h:可供ChatGPT 參考的參數
- myeva.cpp:86EVA 的C++ 程式碼
- myeva.h:86EVA 的Header 檔

補充說明: 86EVA 生成程式碼後,會在主程式 (.ino) 中自動產生以下程式碼,缺一個都會導致86EVA 不運作。
#include “myeva.h”
:引入EVA 的Header 檔EVA.begin();
於setup()
:初始化EVA 功能
Step 4: Turn on ArduBlock and setup
打開ArduBlock。

We use the “if/else” block from the “Control” class to the program’s main loop to judge the EtherCAT Digital Input Pin.

Put under the “loop” area in the “program” block.

Then, we use the “digital Pin” block from the “EtherCAT : Pins” class.

And put in the “if/else” block test area.

The “if/else” will judge the “digital Pin D0” and execute the then or else program.
* Note: we configure the digital input pin in D0.
To execute the digital output action, we use the “set digital output” block from the “EtherCAT : Pins” class.

In the “then” area of “if/else”, it will execute if the “digital pin” is HIGH.
We let the digital output pin pull HIGH if the “digital pin” is HIGH.

In the “else” area of “if/else”, it will execute if the “digital pin” is LOW.
We let the digital output pin pull LOW if the “digital pin” is LOW.

After you finish, click the “Code Generation & Upload” button, and ArduBlock will automatically generate the program code and upload it to the QEC Master.

The program will run when the upload is complete. The digital output pin (LED) will pull HIGH or LOW, depending on the digital input pin (external button).

5. 故障排除
5.1 QEC-M-01無法成功上傳程式碼
When you are unable to successfully upload code, please open 86EVA to check if your QEC EtherCAT Master’s environment is abnormal. As shown in the figure below, please try updating your QEC EtherCAT Master’s environment, which will include the following three items: Bootloader, EtherCAT firmware, and EtherCAT tool.

現在,我們將進一步解釋如何進行更新:
步驟1. 設置 QEC-M
- 下載和安裝 86Duino IDE 500(或更新的版本):你可以從後方連結下載: 軟體.
- 連接 QEC-M 主站:使用 USB 纜線將 QEC-M 主站連接到電腦上。
- 打開 86Duino IDE:在安裝完成後,打開 86Duino IDE 軟體。
- 選擇開發板:從 IDE 選單中選擇「工具」>「開發板」>「QEC-M-01」(或您正在使用的 QEC-M 的特定型號)。
- 選擇連接埠:在 IDE 的選單中,選擇 "工具"(Tools) > "連接埠"(Port),並選擇與 QEC-M 主站連接的 USB 埠。
步驟2. 點擊 Burn Bootloader 按鈕
連接到 QEC-M 產品後,進入「Tool」>「Burn Bootloader」。 目前所選的 QEC-M 名稱將會出現。 單擊它將開始更新過程,該過程大約需要 5-20 分鐘。
- QEC-M-01:

步驟3. 完成更新
完成以上步驟後,你的 QEC-M 主站就已經成功更新至最新版本開發環境了。
如需更多資訊和樣品請求,請寫信至 info@qec.tw,致電離您最近的 ICOP分公司,或聯絡我們的 官方全球經銷商。