Hello Guest it is April 13, 2021, 01:48:08 PM

Author Topic: How to use an input to activate an output.  (Read 263 times)

0 Members and 1 Guest are viewing this topic.

How to use an input to activate an output.
« on: August 02, 2020, 08:19:48 PM »
I would like to take an input to my motion controller (PMDX416) and in mach4 software use this input to activate an output.  To be specific I want to get step and direction inputs from an out side source (THC) and have a script (or some other method) that allows the inputs to activate the same outputs that now control a stepper motor.  This is for a plasma torch.  I have a torch touch off set up in the gcode.  When the code comes to the touch off I want mach4 to take control and activate the outputs as usual but when the probe action is over I want the input from the THC to control the output.  By design the THC should take the z axis output from the motion controller and pass it on through to the stepper controller when the torch is not on but it has stopped doing this.  I think maybe some failed circuit in the THC  is causing this.  The THC does still send step and dir signals when the torch is on.  This failure to send the output for the step and dir from mach4 to the THC causes the probe action not to work.  I have checked the motion controller and the outputs work but get lost trying to pass through the THC like they used to do.


If I were writing this in some simple programming language I might do;
if step signal from mach4 or step signal from THC (input) set output to true
  else set output false;
endif

With the same sort of routine for direction.
Unfortunately I do not know the LUA scripting to do this.  Can someone help.


Re: How to use an input to activate an output.
« Reply #1 on: August 03, 2020, 01:39:36 AM »
i think bater first read the document and the sample that have in mach document ,because this is basic
Re: How to use an input to activate an output.
« Reply #2 on: August 03, 2020, 03:23:32 AM »
Hi,
I think you are barking up the wrong tree.

You can indeed get Mach4 to read an input and then activate an output, but there is a delay and that delay will all but preclude you
from using this method for THC.

Firstly your controller will signal Mach4 every once and a while, an ESS for instance does so 40 times a second (every 25ms), and I presume your
PMDX controller will be similar. We will assume that the PC is ready and waiting, not altogether a correct assumption but not too bad,
and that it works out a response almost instantly. Then it will signal the controller but that signal will have to propagate through the
motion buffer, and the ESS (default) is 180ms. The PMDX will be about the same.

Ergo the LEAST delay will be 180ms and maybe longer depending on whether the PC is ready or not and the signaling delay to the PC,
up to 25ms, say.

Such a slow control loop will all but stop you from THC but may be adequate for very long time constant processes like temperature control.

There is some good news however.

Firstly there are two Mach4 controllers which are realtime THC capable, namely the Hicon by Vital Systems and the ESS by Warp9TD.

Secondly, and probably more appealing to you by virtue of not having to buy another controller, is the (relatively) new script base THC feature.
All you need is a THC sensor/decision making unit (the decison is UP or DOWN) like a Proma THC unit and hook that to Mach and allows Machs
script to do the hard work for you.

As a side note the control bandwidth of the script based THC feature is  still a lot slower (10-20Hz) than a genuine realtime controller (100Hz plus)
but not too shabby!

Craig
My wife left with my best friend...
     and I miss him!
Re: How to use an input to activate an output.
« Reply #3 on: August 03, 2020, 10:53:10 PM »
Thanks for the prompt reply.  I will certainly look into that.  Considering that the Proma has stopped me from passing normal control signals through it that could solve the problem with a little re-wiring.  I built a plasma torch to experiment with cnc because I figured that it would be the easiest cnc project to undertake.  Now I think it was not a good choice for a first project.  I guess I should have asked around to see what was the consensus as to what is the easiest cnc project and built that whatever it was.  The good part is I do not really need the plasma torch as I seldom flame cut anything.  Anyway thanks for your help. 

I started thinking I could probably get by without a THC and found that was not correct. 
Then I got a THC with zero support from anyplace and it does a lousy job of control. So I figured a torch touch off would give me a better chance of the torch not wandering off too far but now that I have the torch touch off done the Proma has stopped passing the signal through to the Z axis.  I think this thing is cursed.  Anyway thanks for your prompt reply and your suggestion.   
Re: How to use an input to activate an output.
« Reply #4 on: August 04, 2020, 04:19:52 AM »
Hi,
plasma all but requires THC to be effective, in fact the dynamic response of the THC control loop and the various anti-dive strategies
determine how good any given plasma table is.

Any Windows based CNC solution must be a buffered solution, as Windows cannot ever hope to be realtime, and therefore realtime THC must be enacted by
the motion controller, at considerable cost and complexity.

LinuxCNC however IS a realtime CNC solution and therefore can enact a highly dynamic THC control strategy without an expensive or
complex motion control and worthy of consideration if you are determined to have a plasma table.

Craig
My wife left with my best friend...
     and I miss him!
Re: How to use an input to activate an output.
« Reply #5 on: August 05, 2020, 05:14:56 PM »
Thanks for your reply.  Sorry to have taken so long to get back to you but auto and home maintenance interferes with other thing.  I tried Linux a couple of times in the past but it never was all that easy for me to use.  I am sure I will stick this thing out until it works smoothly.  I do not work on it as much right now as by the time I get to the garage is is very hot there.    I will keep your suggestions in mind.  Again thanks for your reply and assistance.