Low-code Example – Digital Input

Low-code Example – Digital Input

[QEC Tutorial]

For the full tutorial, see Example: Digital Input/Output on QEC with Low-code.

Digital Input

With 86EVA and ArduBlock, using the EtherCAT digital input module to receive external signals and print them out through Serial Port.

Hardware

  • QEC-M-01
  • QEC-R11D0F: EtherCAT 16 Channel Digital Output Slave Module
  • Others: Switch

Circuit

Same as Digital Output, please connect the EtherCAT Out network from QEC-M to the EtherCAT In network of QEC-R11DF0 first. This example will connect an external switch, using Pin8 of the QEC-R11DF0 as the receive signal pin:

  1. Vp power connection external switch
  2. Connect the external switch to Pin8+ of QEC-R11DF0
  3. Pin8- of QEC-R11DF0 is connected back to the GND of the Vp power supply

As shown in the figure.

rn_image_picker_lib_temp_228850c5-c615-466d-a50b-ec309e6c6616

Step 1: 86EVA, EtherCAT Configuration

Go to the 86Duino Coding IDE, open the 86EVA tool, and configure EtherCAT.

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

Step 2: Set up the Virtual Arduino Pin and generate the code

In the screen of the Digital Input slave device, QECR11DF0D, set DI08 as Virtual Pin D0 as the pin selection for the subsequent ArduBlock.

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

After completion, the 86EVA code can be generated.

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

Step 3: ArduBlock setup

Open ArduBlock.

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

We need to print out the signal of Digital Read through the Serial Port, so we drag the serial print block of the Communication class into the program’s main loop.

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

Let the EtherCAT digital pin block from the EtherCAT – Pins class into the main loop and set the pin to D0.

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

However, the original Serial Print’s message block cannot be directly combined with the EtherCAT digital pin block. So, it must be converted from Boolean to String via the glue block, and then it can be printed via Serial Port.

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

In this example, in order to prevent the Digital Input signal from being continuously output in the Serial Port, you can create two variables as the basis for reading the signal change and then print out the signal through the Serial Port after judging whether the received signal is different between the two times by if-else in the main program. In this way, you can use the 86EVA with ArduBlock to receive external digital signals using the EtherCAT digital input module and print them out via Serial Port.

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

Generate the code and upload it.

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

Learn More

You can find more information about the basic QEC applications in the EtherCAT application.
You can also explore Language or Libraries for a more detailed collection of 86Duino IDE programming.

Leave a Comment

Scroll to Top