[QEC Tutorial]
This guide will show you how to use the EtherCAT Master QEC-M-01P and the Digital I/O Slave QEC-RXXDXX Series.
Notes: QEC’s PoE (Power over Ethernet)
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.
Non-PoE type | PoE type |
---|---|
PoE (Power over Ethernet) is a function that delivers power over the network. QEC can be equipped with an optional PoE function to reduce cabling. In practice, PoE is selected based on system equipment, so please pay attention to the following points while evaluating and testing:
- The PoE function of QEC is different and incompatible with EtherCAT P, and the PoE function of QEC is based on PoE Type B, and the pin functions are as follows:
- When connecting PoE and non-PoE devices, make sure to disconnect Ethernet cables at pins 4, 5, 7, and 8 (e.g., when a PoE-supported QEC EtherCAT master connects with a third-party EtherCAT slave).
- QEC’s PoE power supply is up to 24V/3A.
1. Connection and wiring hardware
The following devices are used here:
- QEC-M-01P (EtherCAT Master/PoE)
- QEC-R11D88H-N (EtherCAT Slave 8-ch digital input and 8-ch digital output/PoE)
- 24V power supply
- 24V LED
1.1 QEC-M-01P
QEC EtherCAT master with PoE function.
- Using the EtherCAT Out port (top side) connected to the EtherCAT In port of QEC-R11D88H via RJ45 cable (powered by PoE).
- Connect to Vs+/Vs- and Vp+/Vp- power supplies via EU terminals for 24V power.
1.2 QEC-R11D88H-N
- Connect from VP+ to DO 0+.
- Connect the 24V LED+ terminal to DO 0-.
- Connect the 24V LED- end to the VP-.
2. Software/Development Environment: 86Duino IDE
Download 86duino IDE from https://www.qec.tw/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+ looks like below.
3. Connect to your PC and set up the environment
Follow the steps below to set up the environment:
- Connect the QEC-M-01P to your PC via a Micro USB to USB cable (86Duino IDE installed).
- Turn on the QEC power.
- Open “Device Manager” (select in the menu after pressing Win+X) ->” Ports (COM & LPT)” in your PC and expand the ports; you should see that the “Prolific PL2303GC USB Serial COM Port (COMx)” is detected; if not, you will need to install the required drivers.
(For the Windows PL2303 driver, you can download it here)
- Open the 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. Write code
The EtherCAT master (QEC-M-01P) and the Digital IO slave (QEC-R11D88H-N) can be configured and programmed via the EtherCAT library in the 86Duino IDE.
The Arduino development environment has two main parts: setup()
and loop()
, which correspond to initialization and main programs. Before operating the EtherCAT network, you must configure it once. The process should be from Pre-OP to OP mode in EtherCAT devices.
The following example is setting Pin0 of Digital Output to HIGH for 4 seconds and then changing it to LOW for 1 second.
4.1.1 For QEC slaves
When using QEC Slave, you can use the dedicated QEC Ethercat Slave Library. For example, QEC-R11D88H can be used EthercatDevice_DmpDIQ_Generic Class. The example code is as follows:
#include "Ethercat.h" EthercatMaster master; EthercatDevice_QECR11D88H slave; void setup() { master.begin(); slave.attach(0, master); master.start(1000000, ECAT_SYNC); } void loop() { slave.digitalWrite(0, HIGH); delay(4000); slave.digitalWrite(0, LOW); delay(1000); }
4.1.2 For third-party slaves
When using a non-QEC slave, you can use the EthercatDevice_Generic function, which can be referenced EthercatDevice Class. The example code is as follows and can also be used in QEC-R11D88H.
#include "Ethercat.h" EthercatMaster master; EthercatDevice_Generic slave; void setup() { master.begin(); slave.attach(0, master); master.start(1000000, ECAT_SYNC); } void loop() { slave.pdoBitWrite(0, HIGH); delay(4000); slave.pdoBitWrite(0, LOW); delay(1000); }
Note: Once the code is written, click on the toolbar to compile, and to confirm that the compilation is complete and error-free, you can click to upload. The program will run when the upload is complete, and the LED will start flashing.
5. Troubleshooting
5.1 QEC-M-01 cannot successfully upload the code
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.
Now, we will further explain how to proceed with the update:
Step 1: Setting up QEC-M
- Download and install 86Duino IDE 500 (or a newer version): You can download it from Software.
- Connect the QEC-M: Use a USB cable to connect the QEC-M to your computer.
- Open 86Duino IDE: After the installation is complete, open the 86Duino IDE software.
- Select Board: From the IDE menu, choose “Tools” > “Board” > “QEC-M-01” (or the specific model of QEC-M you are using).
- Select Port: From the IDE menu, choose “Tools” > “Port” and select the USB port to which the QEC-M is connected.
Step 2: Click “Burn Bootloader” button
After connecting to your QEC-M product, go to “Tools”> “Burn Bootloader”. The currently selected QEC-M name will appear. Clicking on it will start the update process, which will take approximately 5-20 minutes.
- QEC-M-01:
Step 3: Complete the Update
After completing the above steps, your QEC-M has been successfully updated to the latest version of the development environment.
For more information and sample requests, please write to info@qec.tw, call your nearest ICOP branch, or contact our official global distributor.