Author Topic: Rebuilding a old setup  (Read 4771 times)

Mike Abbott

  • Posts: 33
    • View Profile
Rebuilding a old setup
« on: May 15, 2016, 12:28:01 AM »
So I moved about 10 years ago and my CNC mill sat in a pile and I'm just getting around to reviving it.

My setup for the controller was Mach2, Sound logic controller/breakout and gecko 320 drives.  The system when it was functioning worked quite well but i've lost the original setup of Mach2 and just don't want to fool with the old software/hardware.

I've been looking at the PMDX424 with Mach4 and keeping the drives.  I rather like the usb connection of the newer hardware and have a good computer to run it off of.  Just wanting to make sure I'm not skipping ahead of myself on what I'm thinking should work.

Mike

Bob at PMDX

  • Administrator
  • Posts: 368
    • View Profile
    • PMDX
Re: Rebuilding a old setup
« Reply #1 on: May 16, 2016, 11:17:28 AM »
The PMDX-424 is a good upgrade for your system.  It will interface to your existing G320 drivers (set the "step/dir common" to +5V in our plug-in config, see the PMDX-424 Quick Start guide page 7).  Unlike the Sound Logic board, there are not dedicated input terminals for X/Y/Z home.  These can be connected to any of inputs on the PMDX-424.  There is one relay on the PMDX-424, and you can add the PMDX-407 if you want to control spindle speed from Mach4.

Do you have the G320's ERR/RESET signals connected to anything besides +5V?

If so, the PMDX-424 does not (yet) directly support this function.  It is possible to connect the ERR/RESET terminals to one of the *isolated* inputs on the PMDX-424, and then using some Lua scripting code cause that to issue an EStop to Mach4 (we can show you how, if you need this).  However, you will still need an external switch to reset the G230s.  We are considering an add-on board for the PMDX-424 that would interface to the ERR/RESET and allow the error state to issue an EStop directly (no Lua programming necessary) and also allow the PMDX-424 to reset the G320s to take them out of the error state.

If you need the ERR/RESET functionality right now - your best bet would be a PMDX-411 or PMDX-410 along with a PMDX-126.  The PMDX-126 has hardware support for the G320's ERR/RESET signal.

Let us know if you have any more questions.

Bob
Engineering Hell: Everything's right and nothing works.
Bob's Corollary: If everything's right and nothing works, double check your assumptions.

Mike Abbott

  • Posts: 33
    • View Profile
Re: Rebuilding a old setup
« Reply #2 on: May 16, 2016, 03:54:50 PM »
Excellent information.

I've got a small separate board (can't recall exactly where I got it, it was a long time ago) from the sound logic board that takes care of the Err/Reset with some toggle switches on the front of the case it's in.  Since I'm probably going to be diving into this in the near future i'll keep an eye out for add-on board for the PMDX-424.

Mike

Mike Abbott

  • Posts: 33
    • View Profile
Re: Rebuilding a old setup
« Reply #3 on: May 29, 2016, 11:05:27 AM »
Well I decided I didn't like the solution I had for the err/res in this new configuration.  Can you let me know the details of the scripting you are referring to?  I don't mind the notion of an external switch to reset the G320's but I do want mach4 to know if they've gone into an error state and estop.

Mike

Bob at PMDX

  • Administrator
  • Posts: 368
    • View Profile
    • PMDX
Re: Rebuilding a old setup
« Reply #4 on: June 01, 2016, 03:09:41 AM »
Sorry for taking so long to respond.  This is an involved answer that depends on which screen set you are using.  I'll post the full response tomorrow.
Engineering Hell: Everything's right and nothing works.
Bob's Corollary: If everything's right and nothing works, double check your assumptions.

Bob at PMDX

  • Administrator
  • Posts: 368
    • View Profile
    • PMDX
Re: Rebuilding a old setup
« Reply #5 on: June 01, 2016, 11:06:25 AM »
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.0

Also 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:
Code: [Select]
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:
Code: [Select]
-------------------------------------------------------
--  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:
Code: [Select]
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:
Code: [Select]
---------------------------------------------------------------
-- 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:
Code: [Select]
[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
Engineering Hell: Everything's right and nothing works.
Bob's Corollary: If everything's right and nothing works, double check your assumptions.