How to use input to trigger estop

This brief project outlines the approach users can take to obtain special functionality in TNG software that isn't provided by the system by default. It will illustrate the necessary steps users need to take to locate all the required resources and tools for their solution.

Functionality requirements

We want to achieve a functionality where digital input of controller, when activated, will trigger Estop.

It is always good to write down and clarify all application requirements that define and outline the functionality. Below is the short list of ours:

  • as a main device, Mk3 controller will be used
  • when digital inputs 1-4 of motion controller will be activated, TNG software will fall into Estop state.
  • constant evaluation of input condition is necessary, this means inputs need to be evaluated during program run as also other system states (idle, pause etc..)
  • Estop state can be resumed using a Estop keyboard short key, with condition that none of the controller inputs 1-4 is active

Finding a resources and documentation

One of the key factors of building and finishing a project is to find the right resources, that being either user manuals for hardware, API documentation, programming examples etc…

Mk3 controller user manual

Because we want to use Mk3 controller, first we need locate the controller user manual where all controller information should be available:

To read more about the INPUT header where inputs of controller are located, and how to wire an input with a button/switch, locate the chapters of user manual as per image below:


Since we need constant input state evaluation, Expressions seem as the right choice as a programming tool, with which we will implement the functionality.

By reading trough the documentation about expressions, user can deepen its knowledge about the topic and starts getting a more clearer picture on what the solution might be.

So, start at CNC.ZONE home page: CNC.ZONE Homepage

Locate the Expression menu item at the side bar: Expressions

To learn more about the Expression tool and all of its capabilities, user can read trough the documentation of supported Functions, Operators and Events.

It is also very useful that user browses trough the existing tutorial and project library published by PlanetCNC support. A lot of information there, many tutorials might already describe a solution. All these can be found in the CNC.ZONE knowledge base: Knowledge Base

Programming the application

Up until know we know the following:

  • we will use Expression as our scripting language.
  • we will use a dedicated expression file, which will be located in our profile folder of TNG and it will inhibit script code
  • code will need to be executed periodically in order to evaluate input conditions

Conditions are inputs states of controller which will define whether Estop will be activated. New assignment is to find a mean that holds that piece of information. You guessed it, we need to find a parameters that are assigned to our controller inputs.

All parameters of TNG software are located under PlanetCNC TNG → Parameters

Since we need to read the actual hardware input of our controller board, we need to focus on the HW section of documented parameters.

if(!_hw_estop && _hw_input|1, exec("#Input1"));
if(!_hw_estop && _hw_input|2, exec("#Input2"));
kb/projects/input_estop/how_to_use_input_to_trigger_estop.txt · Last modified: 2024/03/22 15:20 by planetcnc

Page Tools