I've decided to shorten my originally *very* long answer and make it just "long" by not including all the steps & details involved in editing the screen set. If you are not familiar with editing the screen set look on the Mach4 Support forums here:
https://www.machsupport.com/forum/index.php?board=94.0Also look in the "Child" board called "Mach4 Videos". Specifically, there is one titled "Mach4 Quicky #4 - Where is the Startup Script".
So, lets get to it. The answer depends on which screen set you are using.
In general, there are 2 basic screen sets: those derived from "wxMach.set" and those derived from "wx4.set". If you started with our PMDX sample profile from any of our plug-in releases prior to 0.41.205 (released on May 26th), you are using the "wxMach" screen set. If you started from the "Mach4 Mill" profile, then you are using the "wx4" screen set.
(1) If your profile name is still "PMDX-Sample" or "Mach4Mill", make a copy of the profile and use that copy! These default profiles may (or WILL) get overwritten when you install a new version of Mach4 or our plug-in. To copy the profile, open the Mach4 Loader, highlight your profile name and click on the "Copy Profile" button. Give it a new name, leave the "screen set" name blank to use the same screen set as the original profile, then click on "OK". Now scroll down in the profile list and select your new profile name.
(2) Choose an input signal that you will connect the Gecko fault signal to. This *MUST* be an isolated input on the PMDX-424, which appear on screw terminal connectors J16 and J17, and are labeled "1" through "8". They appear in the Mach4 configuration dialog as "Input1" to "Input8". For this example I'll use input 1. Connect the G320's "ERR/RES" signal to the PMDX-424 terminal "1", and connect the G320's "ENC-" to the PMDX-424's "GND" terminal.
(3) In Mach4, go to the "Configure" menu and select "Mach...". Then click on the "Input Signals" tab. Choose one of the generic input signals "Input #0" to "Input #31" that you will map the PMDX-424 input signal to. You don't *have* to map the PMDX-424 "Input1" to Mach4 signal "Input 1", but if that helps you remember it, that is fine. For this example I will use "Input #0". On the "Input #0" line, click the red "X" in the "Mapping Enabled" column, in the "Device" column select "SmartBOBUSB" and then in the "Input Name" column select "Input1". Finally, in the "Active Low" column, click the red "X" to change it to a green check mark, as the G320 fault output is active low. Click on "OK" to close the dialog and save the changes.
(4) Edit the screen set (see Mach4 support forums mentioned above).
(5) Create a copy of the screen set: For the same reasons you created a copy of your profile above, create a copy of the screen set that you are about to modify. Go to the "Screen" menu and select "Save Screen As", then give your screen set a new name.
(6) Open the "Signal Script". Here is where it gets interesting. If you see the following code:
local inst = mc.mcGetInstance();
if (sig == mc.OSIG_MACHINE_ENABLED) then
machEnabled = state;
end
then your screen set is based on the wxMach screen set.
Go to setp (7).
If instead you see this:
-------------------------------------------------------
-- Signal Script
-------------------------------------------------------
if SigLib[sig] ~= nil then
SigLib[sig](state);
end
then your screen set is based on the wx4 screen set.
Skip step (7) and go to step (8).(7) For "wxMach" based screen sets, append the following code in the "Signal Script" that you are viewing:
if ( sig == mc.ISIG_INPUT0 ) then
if (state == 1) then
local inst = mc.mcGetInstance();
local hsig;
local isEnabled;
hsig = mc.mcSignalGetHandle( inst, mc.OSIG_MACHINE_ENABLED );
isEnabled = mc.mcSignalGetState( hsig );
if ( isEnabled == 1 ) then
mc.mcCntlEnable( inst, 0 );
mc.mcCntlSetLastError( inst, "Gecko Fault, machine halted" );
else
-- Remove the "--" from the following to see messages if Mach4 is already disabled
-- mc.mcCntlSetLastError( inst, "Ignoring Gecko Fault" );
end
end
end
Go to the "File" menu and select "Save", or click on the "save" icon. Then close the script editor.
Go to step 9.(8) For "wx4" based screen sets, close the script editor window and then open the "Screen Load Script". A few lines down you will see code that looks like this:
---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {
[mc.OSIG_MACHINE_ENABLED] = function (state)
machEnabled = state;
scr.SetProperty('btnRefAll', 'Enabled', tostring(state));
scr.SetProperty('btnRefAll2', 'Enabled', tostring(state));
scr.SetProperty('btnGotoZero', 'Enabled', tostring(state));
scr.SetProperty('tabJogging', 'Enabled', tostring(state));
if (state == 1) then
AxisEnable();
end
end,
[mc.ISIG_INPUT0] = function (state)
end,
*** LOTS MODE CODE LIKE THIS FOLLOWS ***
Note the last bit of code I quoted above starts with "[mc.ISIG_INPUT0] = ..." and ends with "end,". Insert the following code between those two lines so it ends up looking like this:
[mc.ISIG_INPUT0] = function (state) -- THIS LINE WAS ALREADY IN THE SCRIPT!!!
if (state == 1) then
local hsig;
local isEnabled;
hsig = mc.mcSignalGetHandle( inst, mc.OSIG_MACHINE_ENABLED );
isEnabled = mc.mcSignalGetState( hsig );
if ( isEnabled == 1 ) then
mc.mcCntlEnable( inst, 0 );
mc.mcCntlSetLastError( inst, "Gecko Fault, machine halted" );
else
-- Remove the "--" from the following to see messages if Mach4 is already disabled
-- mc.mcCntlSetLastError( inst, "Ignoring Gecko Fault" );
end
end
end, -- THIS LINE WAS ALREADY IN THE SCRIPT!!!
Save the script and close the script editor.
(9) For good measure, exit Mach4 and re-start it. You should now be able to enable Mach4, then connect the input on the PMDX-424 to the "GND" terminal on J16 or J17 and have Mach4 disabled and see the message.
Bob