Hello Guest it is May 15, 2021, 08:29:40 PM

Author Topic: Jogging Really Rough With New MPG Pendant  (Read 301 times)

0 Members and 1 Guest are viewing this topic.

Jogging Really Rough With New MPG Pendant
« on: November 02, 2020, 10:09:28 PM »
Hi all,
Been working on installing a MPG pendant on my mill. It's the generic type, 4 axis switch, 3 speed switch, enable button, E-stop and of course the MPG. And about 20 wires to find a home for.
Managed to get it all wired up and working after a few days of research and some hair pulling, however there are two one bumps that have propped up that have me and google stumped.

1. On Mach4 screen set, I have jogging buttons that work as per usual but when I press the "Button Jog Mode" the boxes ether side ( "0.0010" and "Continuous" ) don't change appearances, ie the "0.0010" doesn't change from gray to white and the "Continuous" doesn't change to "Incremental". The function works fine though, there's just no indication if it's in Continuous or Incremental mode.
    I should note that the machine jogs smoothly when using these buttons. I added a sketch to the screen set to run the pendant but didn't alter anything outside of that.

2. When jogging with the pendant MPG it makes the whole machine rattle. When set to move X1, it's not to bad. X10 gets louder and X100 is kind of scary. At first I thought it was the acceleration and velocity I forgot to set on the MPG tab under Configure so I set them to the same setting as is under the Motors tab. 7000 velocity and 1200 acceleration but this made no difference?
    Scratch this, just got it figured out. MPG Velocity and Acceleration are %'s not actual. Set them both to 100 and
    rough jogging is cured.

Would be nice to figure out screen jogging button issue though, any suggestions??

Cheers,
J

Offline smurph

*
  • *
  •  1,402 1,402
  • "That there... that's an RV."
    • View Profile
Re: Jogging Really Rough With New MPG Pendant
« Reply #1 on: November 14, 2020, 02:27:04 AM »
Hmm...  My screen set works as expected regarding the incremental vs. continuous.  The label changes from continuous to incremental and the increment size enable/disables.  Maybe your screen set has been modified? 

What screen set are you using?  What build did you install? 

Steve
Re: Jogging Really Rough With New MPG Pendant
« Reply #2 on: November 14, 2020, 11:19:23 PM »
Started working on a modified version wx4.set. No scripting at this stage just moving stuff around. I will have to add script for homing to enabling soft limits after homing and I'll also add script for the MPG Pendant.
I've just updated to the current recommended version 4517 along with the 260 version of the ESS Plugin. I'm having to reconfigure everything so will take some time before I know if it all works like it should.
Will let you know how I get on.
Cheers,
J

Sketch for soft limits
Code: [Select]
---------------------------------------------------------------
-- Ref All Home() function.
---------------------------------------------------------------
function RefAllHome()
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    mc.mcAxisHomeAll(inst)
    coroutine.yield() --yield coroutine so we can do the following after motion stops
    ----See ref all home button and plc script for coroutine.create and coroutine.resume
    wx.wxMessageBox('Referencing is complete.\nSoft Limits Set.')
    SetSoftlimits()
end

-------------------------------------------------------
--  Set Soft Limits
-------------------------------------------------------
function SetSoftlimits()
    for v = 0, 5, 1 do --start, end, increment
        mc.mcSoftLimitSetState(inst, v, mc.MC_ON)
       
    end
    scr.SetProperty("tbtnSoftLimits", "Button State", tostring(1))
    scr.SetProperty("tbSoftLimits", "Button State", tostring(1))
   
end

Re: Jogging Really Rough With New MPG Pendant
« Reply #3 on: November 14, 2020, 11:20:46 PM »
Sketch for MPG (1st half)
Code: [Select]
---------------------------------------------------------------
-- Monitor the switches on the Pendant.
-- We break the three different mechanical switches into three separate function calls, since each function has a separate job.
-- We don't need to assign the MPG wheel since Mach handles that for us.
---------------------------------------------------------------
SigLib = {


    [mc.ISIG_INPUT0] = function (state)   --If you are not using INPUT0 for the Axis Selection X, change the INPUT#!!!!
        PendantAxisChange()                     --This is called if there is a change with the Pendant's Axis Selection Switch Posion X
    end,


    [mc.ISIG_INPUT1] = function (state)   --If you are not using INPUT1 for the Axis Selection Y, change the INPUT#!!!!
        PendantAxisChange()                     --This is called if there is a change with the Pendant's Axis Selection Switch Posion Y
    end,


    [mc.ISIG_INPUT2] = function (state)   --If you are not using INPUT2 for the Axis Selection Z, change the INPUT#!!!!
        PendantAxisChange()                     --This is called if there is a change with the Pendant's Axis Selection Switch Posion Z
    end,


    [mc.ISIG_INPUT3] = function (state)   --If you are not using INPUT3 for the Axis Selection 4, change the INPUT#!!!!
        PendantAxisChange()                     --This is called if there is a change with the Pendant's Axis Selection Switch Posion 4
    end,


    [mc.ISIG_INPUT4] = function (state)   --If you are not using INPUT4 for the Axis Selection 5, change the INPUT#!!!! 
        PendantAxisChange()                     --This is called if there is a change with the Pendant's Axis Selection Switch Posion 5
    end,


    [mc.ISIG_INPUT5] = function (state)   --If you are not using INPUT5 for the Axis Selection 6, change the INPUT#!!!!
        PendantAxisChange()                     --This is called if there is a change with the Pendant's Axis Selection Switch Posion 6
    end,

-------------
    [mc.ISIG_INPUT6] = function (state)       --If you are not using INPUT6 for theX1 Selection, change the INPUT#!!!!
        PendantSpeedChange()                      --This is called if there is a change with the Pendant's Rate Selection Switch X1
    end,


    [mc.ISIG_INPUT7] = function (state)       --If you are not using INPUT7 for the X10 Selection, change the INPUT#!!!!     
        PendantSpeedChange()                     --This is called if there is a change with  the Pendant's Rate Selection Switch X10
    end,


    [mc.ISIG_INPUT8] = function (state)       --If you are not using INPUT8 for the X100 Selection, change the INPUT#!!!!     
        PendantSpeedChange()                     --This is called if there is a change with the Pendant's Rate Selection Switch X100
    end,

-------------
    [mc.ISIG_INPUT9] = function (state)     --If you are not using INPUT9 for the Pendant EStop Switch, change the INPUT#!!!!     
        PendantEStopChange()                     --This is called if there is a change with the Pendant's EStop Switch
    end,

-------------

--These next three are not part of the Pendant code, but show you a few more options for inputs

[mc.ISIG_INPUT10] = function (state)       --Performs a Cycle Start

InputCycleStart()

end,

 

[mc.ISIG_INPUT11] = function (state)       --Performs a Cycle Stop

InputCycleStop()

end,

 

[mc.ISIG_INPUT12] = function (state)       --Performs a reset

InputReset()

end
}

 

---------------------------------------------------------------

-- The Input Signal for a Cycle Start Occurred. This is not needed for the rest of the pendant example

---------------------------------------------------------------

function InputCycleStart() --This will do a cycle start because of a button push

     CycleStart()

     mc.mcCntlSetLastError(inst, "Input Cycle Start")

end

 

---------------------------------------------------------------

-- The Input Signal for a Cycle Stop Occurred. This is not needed for the rest of the pendant example

---------------------------------------------------------------

function InputCycleStop() --This will do a cycle stop because of a button push

     CycleStop()

     mc.mcCntlSetLastError(inst, "Input Cycle Stop")

end

 

---------------------------------------------------------------

-- The Input Signal for a Reset Occurred. This is not needed for the rest of the pendant example

---------------------------------------------------------------

function InputReset() --This will do a Reset because of a button push

     mc.mcCntlReset(inst)

     mc.mcSpindleSetDirection(inst, 0)

     mc.mcCntlSetLastError(inst, "Input Reset")

end



--In Mach's Config tab for MPGs, if you don't have the ESS's encoder for the pendant assigned to MPG#7, change the 7 to the number you are using:
local MachMpgNumberForPendant = 7

local PendantStepSize = 0.001 --This is in your Mach4's units, mm or Inches, whichever one you have it set to
local PendantDistanceX1 = PendantStepSize * 1    --Multiply by one
local PendantDistanceX10 = PendantStepSize * 10    --Multiply by ten
local PendantDistanceX100 = PendantStepSize * 100    --Multiply by one hundred

--These shouldn't need to be modified, but they reduce the amount of apparently random numbers in the code:
local UnmapMPG = -1         --Use this one for when Axis selector switch is set to OFF
local AxisNumber_X = 0       -- Linear axis X (one of six coordinated motion axes)
local AxisNumber_Y = 1       -- Linear axis Y (one of six coordinated motion axes)
local AxisNumber_Z = 2       -- Linear axis Z (one of six coordinated motion axes)
local AxisNumber_UA = 3       -- Linear axis U or Rotational axis A
local AxisNumber_VB = 4       -- Linear axis V or Rotational axis B
local AxisNumber_WC = 5       -- Linear axis W or Rotational axis C
local AxisNumber_OB0 = 6       -- Out of Band axis 0 (NOT coordinated with motion)
local AxisNumber_OB1 = 7       -- Out of Band axis 1 (NOT coordinated with motion)
local AxisNumber_OB2 = 8       -- Out of Band axis 2 (NOT coordinated with motion)
local AxisNumber_OB3 = 9       -- Out of Band axis 3 (NOT coordinated with motion)
local AxisNumber_OB4 = 10        -- Out of Band axis 4 (NOT coordinated with motion)
local AxisNumber_OB5= 11       -- Out of Band axis 5 (NOT coordinated with motion)

--Coordinated motion means all six coordinated axes get to the destination point at the same time.
--Not coordinated with motion means that axis can be doing whatever, whenever.  Like a conveyor belt that is always running.



---------------------------------------------------------------
-- The Pendant's EStop switch changed...
-- This will process the Pendant's EStop Switch
-- THIS ESTOP SHOULD BE CONSIDERED A COURTESY SIGNAL, since it based on softare
-- You should still have a EStop that is pure hardwre that can disconnect power.

--If you start Mach with the button pressed in, it will not work when you need to press it!
---------------------------------------------------------------
function PendantEStopChange()

    local hPendantEStop
    local PendantEStop
   
    hPendantEStop, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT9)     --If you are not using INPUT9 for the Pendant EStop Switch, change the INPUT#!!!!   
    PendantEStop, rc = mc.mcSignalGetState(hPendantEStop)
       
    if (PendantEStop == 1) then
        mc.mcCntlEStop(inst)  --Activate the EStop signal in Mach
        mc.mcCntlSetLastError(inst, "Pendant EStop Activated")   --Show a message in the Screen Set
    else
        mc.mcCntlSetLastError(inst, "Pendant EStop Cleared")  --Show a message in the Screen Set
    end 
end



---------------------------------------------------------------
-- The Pendant's Speed switch changed... Reconfigure appropriate settings in Mach4 
--This will process the Pendant's Rate/Speed Selection Switch
---------------------------------------------------------------
function PendantSpeedChange()
   

    --Variable prep first for handles
    local hX1
    local hX10
    local hX100
   

    --Variable prep for signal values
    local Step1
    local Step10
    local Step100
   
    hX1, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT6)       --If you are not using INPUT6 for theX1 Selection, change the INPUT#!!!!
    Step1, rc = mc.mcSignalGetState(hX1)
   
    hX10, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT7)       --If you are not using INPUT7 for the X10 Selection, change the INPUT#!!!!  -- X10 Port 3 Pin 4
    Step10, rc = mc.mcSignalGetState(hX10)
   
    hX100, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT8)       --If you are not using INPUT8 for the X100 Selection, change the INPUT#!!!!
    Step100, rc = mc.mcSignalGetState(hX100)
   
    local msg
       
    if (Step1 == 1) then
        mc.mcMpgSetInc(inst, MachMpgNumberForPendant, PendantDistanceX1 )
        msg = "Pendant Distance X1 = " .. PendantDistanceX1
        mc.mcCntlSetLastError(inst, msg)  --Show a message in the Screen Set

    elseif (Step10 == 1) then
        mc.mcMpgSetInc(inst, MachMpgNumberForPendant, PendantDistanceX10)
        msg = "Pendant Distance X10 = " .. PendantDistanceX10
        mc.mcCntlSetLastError(inst, msg)  --Show a message in the Screen Set

    elseif (Step100 == 1) then
        mc.mcMpgSetInc(inst, MachMpgNumberForPendant, PendantDistanceX100)
        msg = "Pendant Distance X100 = " .. PendantDistanceX100
        mc.mcCntlSetLastError(inst, msg)  --Show a message in the Screen Set
    end
   
   
end

   
   
Re: Jogging Really Rough With New MPG Pendant
« Reply #4 on: November 14, 2020, 11:21:32 PM »
Sketch for MPG (2nd half)
Code: [Select]
---------------------------------------------------------------
-- The Pendant's Axis switch changed... Reconfigure appropriate settings in Mach4 and turn the Pendant LED ON/OFF
--This will process the Pendant's Axis Selection Switch
---------------------------------------------------------------
function PendantAxisChange()
 
    --Variable prep first for handles
    local hAxis_X  --Position X on Pendant Switch
    local hAxis_Y  --Position Y on Pendant Switch
    local hAxis_Z  --Position Z on Pendant Switch
-- Chose one of these for position 4 ( and another for 5 and 6 if applicable)
    local hAxis_UA  --Use this with a 4, 5 or 6 axis pendant
    local hAxis_VB  --Use this with a 4, 5 or 6 axis pendant
    local hAxis_WC  --Use this with a 4, 5 or 6 axis pendant 
    local hAxis_OB0  --Use this with a 4, 5 or 6 axis pendant
    local hAxis_OB1  --Use this with a 4, 5 or 6 axis pendant
    local hAxis_OB2  --Use this with a 4, 5 or 6 axis pendant
    local hAxis_OB3  --Use this with a 4, 5 or 6 axis pendant
    local hAxis_OB4  --Use this with a 4, 5 or 6 axis pendant
    local hAxis_OB5  --Use this with a 4, 5 or 6 axis pendant

    --Variable prep for signal values, MAKE SURE YOU MATCH THE ONES IN HERE WITH THE ONES JUST ABOVE
    local SelectAxis_X
    local SelectAxis_Y
    local SelectAxis_Z
-- Chose one of these for position 4 ( and another for 5 and 6 if applicable) 
    local SelectAxis_UA  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_VB  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_WC  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_OB0  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_OB1  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_OB2  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_OB3  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_OB4  --Use this with a 4, 5 or 6 axis pendant
    local SelectAxis_OB5  --Use this with a 4, 5 or 6 axis pendant
   
    hAxis_X, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT0)   --If you are not using INPUT0 for the Axis Selection Switch X, change the INPUT#!!!!
    SelectAxis_X, rc = mc.mcSignalGetState(hAxis_X)
   
    hAxis_Y, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1)   --If you are not using INPUT1 for the Axis Selection Switch Y, change the INPUT#!!!!
    SelectAxis_Y, rc = mc.mcSignalGetState(hAxis_Y)
   
    hAxis_Z, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT2)   --If you are not using INPUT2 for the Axis Selection Switch Z, change the INPUT#!!!!
    SelectAxis_Z, rc = mc.mcSignalGetState(hAxis_Z)

--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE   
--   hAxis_UA, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT3)   --If you are not using INPUT3 for the Axis Selection Switch 4, change the INPUT#!!!!
--   SelectAxis_UA, rc = mc.mcSignalGetState(hAxis_UA)
   
--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
--   hAxis_VB, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT4)   --If you are not using INPUT4 for the Axis Selection Switch 5, change the INPUT#!!!!
--   SelectAxis_VB, rc = mc.mcSignalGetState(hAxis_VB)
       
--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
--   hAxis_WC, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5)   --If you are not using INPUT5 for the Axis Selection Switch 6, change the INPUT#!!!!
--   SelectAxis_WC, rc = mc.mcSignalGetState(hAxis_WC)
   
--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
--   hAxis_OB0, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5)   --If you are not using INPUT5 for the Selection Switch 6, change the INPUT#!!!!
--   SelectAxis_OB0, rc = mc.mcSignalGetState(hAxis_OB0)

--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
--   hAxis_OB1, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5)   --If you are not using INPUT5 for the Axis Selection Switch 6, change the INPUT#!!!!
--   SelectAxis_OB1, rc = mc.mcSignalGetState(hAxis_OB1)

--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
--   hAxis_OB2, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5)   --If you are not using INPUT5 for the Axis Selection Switch 6, change the INPUT#!!!!
--   SelectAxis_OB2, rc = mc.mcSignalGetState(hAxis_OB2)

--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
--   hAxis_OB3, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5)   --If you are not using INPUT5 for the Axis Selection Switch 6, change the INPUT#!!!!
--   SelectAxis_OB3, rc = mc.mcSignalGetState(hAxis_OB3)

--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
--   hAxis_OB4, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT5)   --If you are not using INPUT5 for the Axis Selection Switch 6, change the INPUT#!!!!
--   SelectAxis_OB4, rc = mc.mcSignalGetState(hAxis_OB4)

--I AM USING THIS ONE with Axis Selection Switch 4 to move axis OB5
--   Use this with a 4, 5 or 6 axis pendant  RESERVED - NOT CURRENTLY IN USE
   hAxis_OB5, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT3)   --If you are not using INPUT3 for the Axis Selection Switch 4, change the INPUT#!!!!
   SelectAxis_OB5, rc = mc.mcSignalGetState(hAxis_OB5)



    --This is the Pendant's LED, and it will be ON when an axis is active on the Pendant's switch
    local hLedForActivePendantAxis
    hLedForActivePendantAxis, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)-- Pendant LED Port 3 Pin 1
       
       
   
   
   
    --Now actual axis Selection Switch processing code

    if (SelectAxis_X == 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_X)    --Map the MPG to control the X Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis X Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)       --Turn the Pendant's LED ON to show an axis is active
       
    elseif (SelectAxis_Y== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_Y)    --Map the MPG to control the Y Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis Y Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)       --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_Z== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_Z)    --Map the MPG to control the Z Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis Z Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)       --Turn the Pendant's LED ON to show an axis is active

--Not all of these remaining elseif's will be used in your setup, but it is okay to leave them active.
    elseif (SelectAxis_UA== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_UA)    --Map the MPG to control the U/A Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis U/A Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active
   
    elseif (SelectAxis_VB== 1) then
       mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_VB)     --Map the MPG to control the V/B Axis
       mc.mcCntlSetLastError(inst, "Pendant Axis V/B Selected")  --Show a message in the Screen Set
       mc.mcSignalSetState(hLedForActivePendantAxis, 1)           --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_WC== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_WC)    --Map the MPG to control the W/C Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis W/C Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_OB0== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_OB0)    --Map the MPG to control the OB0 Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis OB0 Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_OB1== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_OB1)    --Map the MPG to control the OB1 Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis OB1 Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_OB2== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_OB2)    --Map the MPG to control the OB2 Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis OB2 Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_OB3== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_OB3)    --Map the MPG to control the OB3 Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis OB3 Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_OB4== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_OB4)    --Map the MPG to control the OB4 Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis OB4 Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active

    elseif (SelectAxis_OB5== 1) then
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, AxisNumber_OB5)    --Map the MPG to control the OB5 Axis
        mc.mcCntlSetLastError(inst, "Pendant Axis OB5 Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 1)            --Turn the Pendant's LED ON to show an axis is active
   
    else
        --None of the Axis Switch inputs are active, so unmap the MPG from all axes (by assigning an invalid axis -1)
        mc.mcMpgSetAxis(inst, MachMpgNumberForPendant, UnmapMPG )     --Unmap the MPG, so it won't control any axes
        mc.mcCntlSetLastError(inst, "NO Pendant Axis Selected")  --Show a message in the Screen Set
        mc.mcSignalSetState(hLedForActivePendantAxis, 0)           --Turn the Pendant's LED OFF to show no axis is active
    end
   

end

 


--We will now call the  three functions we made

--This is so the functions  will be initalized to the current pendant values

--When the Screen is loaded by Mach4


PendantEStopChange()
PendantSpeedChange()
PendantAxisChange()
Re: Jogging Really Rough With New MPG Pendant
« Reply #5 on: November 22, 2020, 03:03:38 AM »
Ok so after updating the software to the latest release, Reconfiguring Mach 4 and the ESS pins I/O, all that was left was to place the MPG pendant and Homing/Soft limits code in the screen set.
I took some time to try to understand how the screen set code is laid out and carefully placed the different parts of the MPG and homing code were I thought it should go. Not sure what exactly what the jogging button issue was but this fixed it.
It's running flawlessly again with the added benefit of an MPG. And through all this have a greater understanding of how  everything works.