Low-code Example – Digital Output/Input

Low-code Example – Digital Output/Input

[QEC教程]

完整教學請參見 範例:採用低程式碼開發 QEC 數位輸入/輸出.

Digital Output/Input

With the 86EVA and ArduBlock, using the external LEDs are blinked by the Digital Output, and the status of the LEDs is received through the Digital Input and printed out through the Serial Port.

硬體說明

  • QEC-M-01
  • QEC-R11DF0: EtherCAT 16數位輸入通道從站模組
  • QEC-R11D0F: EtherCAT 16數位輸出通道從站模組
  • 其他: 24V LED

電路

請先將QEC-M上的EtherCAT Out網路與QEC-R11D0F的EtherCAT In網路連接,以及QEC-R11D0F的EtherCAT Out網路與QEC-R11DF0的EtherCAT In網路連接。

此範例將使用Vp電源作為QEC-R11D0F Pin0的電源,透過使用QEC-R11DF0的Pin8 作為接收信號腳位。

  1. Vp電源連接到QEC-R11D0F Pin0+
  2. QEC-R11D0F Pin0-連到LED的VCC
  3. LED GND接到QEC-R11DF0的Pin8+
  4. QEC-R11DF0的Pin8-接回Vp電源的GND

如圖所示。

qec_dio

步驟1:86EVA的EtherCAT配置

進入86Duino Coding IDE,開啟86EVA工具,設定EtherCAT。

1-DIQ-eva(en)-3-1

步驟2:設定虛擬 Arduino 引腳並產生程式碼

In the screen of the Digital Output slave device, QECR11D0FS, set DQ00 to the Virtual Pin D0 of the Arduino.

1-DIQ-eva(en)-3-2

In the screen of the Digital Input slave device, QECR11DF0D, set DI08 to the Virtual Pin D1 of the Arduino.

1-DIQ-eva(en)-3-3

完成後即可產生86EVA程式碼。

1-DIQ-eva(en)-3-4

步驟3:ArduBlock 設置

打開ArduBlock。

1-DIQ-eva(en)-3-5

We need to set Output’s Pin0 to High and read Input’s Pin8, then print it in Serial Port, with a delay of 4000 ms. After that, set Output’s Pin0 to Low and read Input’s Pin8, then print it in Serial Port, with a delay of 1000 ms.

The building blocks are as follows.

1-DIQ-eva(en)-3-6

產生程式碼並上傳。

1-DIQ-eva(en)-3-7

學習更多

你可以在下方找到更多關於QEC基礎應用的信息 EtherCAT應用.
您還可以探索 程式語法參考 或 函式庫參考 更詳細的86Duino IDE程式設計集合。

發表評論

上部へスクロール