Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: MitchB on December 30, 2015, 07:53:17 PM

Title: In order to use F5 as Feed Hold, do I write a script?
Post by: MitchB on December 30, 2015, 07:53:17 PM
Before I delve into this, I wanted to see if there's a simple way to assign Feed Hold to a keyboard key.  Thanks.
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: ger21 on December 30, 2015, 08:03:25 PM
Hit the space bar.
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: MitchB on December 30, 2015, 08:06:52 PM
That worked for me in Mach 3.  Not in Mach 4.
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: ger21 on December 30, 2015, 08:11:42 PM
Sorry, I didn't see it was Mach4.
What about the keyboard plugin?
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: MitchB on December 30, 2015, 09:17:25 PM
I don't see a Feed Hold function that I can assign to a key.  I don't know if that means I need to write one or if it is somewhere that I don't see it.  I see only functions for jogging.
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: DazTheGas on December 31, 2015, 01:35:18 AM
The keyboard plugin is for inputs and feedhold is an output.

You could assign a function of none in the plugin and tie this to an input, then in your plc you can activate the feedhold when this input state is changed.

DazTheGas
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: MitchB on December 31, 2015, 08:10:01 AM
Any chance there are step by step instructions somewhere describing how to do that?
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: DazTheGas on December 31, 2015, 10:59:41 AM
This should sort you out http://www.machsupport.com/forum/index.php/topic,31585.0.html (http://www.machsupport.com/forum/index.php/topic,31585.0.html)

DazTheGas
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: MitchB on December 31, 2015, 12:47:24 PM
Wow.  That's great.  I'm looking forward to trying it.  Thanks a lot.
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: MitchB on December 31, 2015, 10:51:41 PM
Is there a reason you put this in the PLC script instead of the Signal script?
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: DazTheGas on January 01, 2016, 03:42:29 AM
No reason they both do the same thing,

DazTheGas
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: dude1 on January 01, 2016, 05:38:19 PM
the other way to do it is as a signal table, it work's the same as what Daz said to do


Code: [Select]
SignalTable = {001,
    [mc.ISIG_INPUT0] = function (on_off)
        if (on_off == 1) then
            mc.mcCntlCycleStart(inst)
        end
    end
}
SignalTable = {002,
    [mc.ISIG_INPUT1] = function (on_off)
        if (on_off == 1) then
            mc.mcCntlCycleStop(inst)
        end
    end
}
SignalTable = {003,
    [mc.ISIG_INPUT2] = function (on_off)
        if (on_off == 1) then
            mc.mcCntlReset(inst)
        end
    end
}
SignalTable = {004,
    [mc.ISIG_INPUT3] = function (on_off)
        if (on_off == 1) then
            mc.mcCntlFeedHold(inst)
        end
    end
}   
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: MitchB on January 01, 2016, 10:57:41 PM
Two Lua questions about your example:

1. Are these table constructors redeclaring SignalTable each time?  Shouldn't all the keys and functions be in one SignalTable?
2. What are the 001, 002, etc. for?
Title: Re: In order to use F5 as Feed Hold, do I write a script?
Post by: dude1 on January 02, 2016, 12:33:11 AM
pass it's what I was told to do