Prerequisites: Before proceeding, ensure you have followed the initial setup guide to wire your hardware, configure static IP networking, and create a base project in CCW. (Hardware Wiring, Network Setup & Project Initialization)

Building on the project setup from the previous section, we will now define the control variables. In this step, we will create three simulated buttons to send commands to the I/O adapter and the robot. These variables will function just like physical push buttons.

  1. Double-click Local Variables under your Main program.

  2. Create three BOOL variables: Button1, Button2, and Button3.

  3. Create a fourth variable named Timer with the TIME data type, and set its Initial Value to T#500ms. This defines the pulse duration for the button signals.

Open the Global Variables table and locate three available physical output channels (e.g., _IO_EM_DO_04, _IO_EM_DO_05, _IO_EM_DO_06). In the Alias column for these outputs, assign the names Output1, Output2, and Output3.

Double-click Main to open the ladder logic editor.

In the first Rung, add a Direct Contact, a TP (Pulse Timer) timer block, and a Direct Coil.  

Create a new Rung by clicking the first icon on the left of the ladder toolbar. On this new rung, add a Direct contact and Reset coil. Depending on your CCW version or settings, the Reset coil may be displayed as (R) (Reset) or (U) (Unlatch).

Double-click the Direct Contact on Rung 1. In the Variable Selector window, set the Scope dropdown to Main, then select Button1

Double-click Button1 to assign it to the Direct Contact.

For the ouput, choose in the Scope field, the PLC model option. In our case, it is the Micro820.

For the Direct Coil, double-click the coil to open the variable selector. In the Scope dropdown, select your PLC model (Micro820) to access the global I/O tags, then choose Output1 (_IO_EM_DO_04).

Click on the entry field direcly next to the PT (Preset Time) pin of the TP timer block, assing the Timer variable to it.

On the second rung's Direct Contact, select the variable TP_1.Q.

How the logic works: When Button1 is activated, the timer output (Q) and hence, Output1 turn ON for 500 ms. Once the timer completes, the TP_1.Q contact closes to trigger the Reset Coil (R) on Button1, returning it to 0 and simulating the release of a physical push button.

Duplicate this exact logic for Button2 (Rungs 3–4) and Button3 (Rungs 5–6), updating the corresponding timer instance names (TP_2, TP_3) and output aliases (Output2, Output3).

At the top of the window, click Connect in the toolbar to go online with the PLC.

In the Connection Browser window, select your Micro820 controller from the list and click OK.

Click Download current project to the controller.

Click Download. 

Click Yes.

Click the toggle switch in the toolbar to change the controller mode from Program to Run, then click OK in the prompt to confirm.

With the PLC configuration and ladder logic now complete, the Micro820 is ready to process signal commands. In the next section, we will integrate these simulated button triggers with the robot controller to execute automated actions.

Robot-side programming

This script allows the robot to be controlled directly by electrical signals sent by the PLC to its ports DI1, DI2, and DI3. In an IDE (e.g. Visual Studio), copy the code found here.

Here are some explanations to better understand its role.

1. Hardware Interaction

This code queries the physical state of the robot pins :

  • Reading signals: the robot.digital_read() function continuously monitors if a voltage is present on the inputs.

  • PinState.HIGH: the robot detects if a button is pressed or if the controller sends an "All or nothing" signal (24 V transformed to 5 V).

2. Role of Physical Commands

The logic is simplified into three direct actions triggered by each input:

  • DI1 (Input 1): starts the auto calibration procedure to reset the motors.

  • DI2 (Input 2): orders an immediate move to the HOME position.

  • DI3 (Input 3): triggers the Vision Pick & Place cycle.

3. Logic and Stability
  • Control loop: the program scans the inputs every 0.5 seconds (robot.wait(0.5)) to avoid saturating the processor while remaining responsive.

  • Priority: the if/elif structure ensures that only one action is processed at a time, thus preventing the robot from attempting to perform two contradictory movements simultaneously.

A [Blockly version of this guide] is also available for visual block-based programming

Tests

In CCW Software, go to the Main-POU and double-click on the Button1 contact.

To activate a button, check the box in the Logical Value column.

Conclusion

Congratulations! You have successfully established end-to-end communication between the Micro820 PLC and the Ned2 robot. Throughout this guide, we covered:

  • Hardware Wiring: Interfacing the I/O Adapter with 24V power and bridging common terminals.
  • Network Setup: Setting static IP addresses across your PC, PLC, and robot subnet.
  • PLC Logic: Programming self-resetting pulse triggers (Button1–Button3) in Connected Components Workbench (CCW).
  • Robot Control: Executing automated commands (Auto-Calibration, Home, and Vision Pick & Place) via Python/Blockly scripts monitoring inputs DI1–DI3.

You can now expand this baseline logic by integrating physical push buttons, adding safety interlocks, or triggering complex robotic routines directly from your PLC system.

Zuletzt geändert: Montag, 21. September 2026, 12:17