Steve, (smurf)
I am having an issue starting our spindle with the latest mach4 versions.
We purchased a new inverter but the same issue came up.
I use HiCON to run it.
We checked all the electricals on our controller and all is fine.
The 10V is being sent.
But the short is not happening.
We tested an older Mach4 version and it worked just fine (wasted purchase)
So the issues are with the newer version of Mach4 and or the Script changes are not working as they should.
Below is my signal script.
If you require the other script changes please advise.
Regards,
Mauri.
if SigLib[sig] ~= nil then
    SigLib[sig](state);
end
--------------------------------------------------------------------------------------
-- HiCON and Controller Button Signal Script
--------------------------------------------------------------------------------------
local inst = mc.mcGetInstance();
if (sig == mc.OSIG_MACHINE_ENABLED) then 
    machEnabled = state;
end
-- Enable/Disable
 if (sig == mc.ISIG_INPUT14) and (state == 1)then --mc.ISIG_INPUT4-- on HiCON Used as an enable button
       wx.wxMilliSleep(10)
        local inst= mc.mcGetInstance();
        local reg = mc.mcSignalGetHandle(inst, mc.OSIG_MACHINE_ENABLED)
        state = mc.mcSignalGetState(reg);
            if(state == 1)then
                state = 0
                hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE3);  
                mc.mcSignalSetState(hsig, 0); --sets Enable_3 to False- Turn off if on
            else
                state = 1
                hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OPT_STOP);  
            mc.mcSignalSetState(hsig, 0); --sets Opt Stop_1 to False
            end
        mc.mcCntlEnable(inst, state);
end
------------------------------------------------------------------------------------
-- Cycle Start
if (sig == mc.ISIG_INPUT13) and (state == 1) then
    wx.wxMilliSleep(10)
    local inst = mc.mcGetInstance()
    mc.mcCntlCycleStart(inst)
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE3);  
    mc.mcSignalSetState(hsig, 1); --sets Enable_3 to True
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OPT_STOP);  
    mc.mcSignalSetState(hsig, 0); --sets Opt Stop_1 to False
end
-------------------------------------------------------------------------------------
local inst = mc.mcGetInstance();
-------------------------------------------------------------------------------------
-- Cycle Stop
if (sig == mc.ISIG_INPUT11) and (state == 1) then
    wx.wxMilliSleep(10)
    local inst = mc.mcGetInstance()
    mc.mcCntlCycleStop(inst)
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OPT_STOP);  
    mc.mcSignalSetState(hsig, 1); --sets Opt Stop_1 to True
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE3);  
    mc.mcSignalSetState(hsig, 0); --sets Enable_3 to False
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5); 
    mc.mcSignalSetState(hsig, 0); --sets Enable_5 to False - Turn off
    local inst= mc.mcGetInstance();
    spindlestate = 0 
    mc.mcSpindleSetDirection(inst, spindlestate);
end
local inst = mc.mcGetInstance();
------------------------------------------------------------------------------------
-- Feed Hold
if (sig == mc.ISIG_INPUT12) and (state == 1) then
    wx.wxMilliSleep(10)
    local inst = mc.mcGetInstance()
    mc.mcCntlFeedHold(inst)
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OPT_STOP);  
    mc.mcSignalSetState(hsig, 0); --sets Opt Stop_1 to True
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE3);  
    mc.mcSignalSetState(hsig, 0); --sets Enable_3 to False
end
------------------------------------------------------------------------------------
local inst= mc.mcGetInstance();
-- Enable/Disable Spindle Button
 if (sig == mc.ISIG_INPUT15) and (state == 1)then --mc.ISIG_INPUT5--Used as an spindle button
       wx.wxMilliSleep(10)
        local inst= mc.mcGetInstance();
        local reg = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5)
        spindlestate = mc.mcSignalGetState(reg);
            if(spindlestate == 1)then
                spindlestate = 0
            hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5); 
            mc.mcSignalSetState(hsig, 0); --sets Enable_5 to True - Turn off 
            else
                spindlestate = 1
            hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5); 
            mc.mcSignalSetState(hsig, 1); --sets Enable_5 to True - Turn on 
            end
        mc.mcSpindleSetDirection(inst, spindlestate);
 end
local inst = mc.mcGetInstance();
local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
local sigState = mc.mcSignalGetState(sigh);
if (sigState == 1) then 
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5); 
            mc.mcSignalSetState(hsig, 1); --sets Enable_5 to True - Turn on 
else 
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5); 
            mc.mcSignalSetState(hsig, 0); --sets Enable_5 to True - Turn off 
end
------------------------------------------------------------------------------------
-- MPG EStop
if (sig == mc.ISIG_INPUT10) and (state == 1) then
---wx.wxSleep(10)= 10 seconds
        local inst= mc.mcGetInstance();
        local reg = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE0)
        estopstate = mc.mcSignalGetState(reg);
            if(estopstate == 0)then
                estopstate = 1
            else 
                estopstate = 0
                mc.mcCntlEStop(inst, estopstate);
                local inst= mc.mcGetInstance();
                local reg = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5)
                spindlestate = mc.mcSignalGetState(reg);
                if(spindlestate == 1)then
                    spindlestate = 0
                    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5); 
                    mc.mcSignalSetState(hsig, 0); --sets Enable_5 to True - Turn off 
                end
            end         
end
-------------------------------------------------------------------------------------
-- E-STOP -- Input #20 to turn off Spindle Light
if (sig == mc.ISIG_INPUT20) then
    local inst = mc.mcGetInstance()
    hsig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_ENABLE5); 
    mc.mcSignalSetState(hsig, 0); --sets Enable_5 to False - Turn off
end