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