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.
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:
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…
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
Up until know we know the following:
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.
#Loop if(!_hw_estop && _hw_input|1, exec("#Input1")); if(!_hw_estop && _hw_input|2, exec("#Input2")); #Input1 estop(1); print("Input1"); status("Input1"); #Input2 estop(1); print("Input2"); status("Input2");