Hello Guest it is March 28, 2024, 06:03:50 AM

Author Topic: Configuring Keys In Key Board Inputs Configuration Table  (Read 3909 times)

0 Members and 1 Guest are viewing this topic.

Offline smav

*
  •  55 55
    • View Profile
Configuring Keys In Key Board Inputs Configuration Table
« on: January 27, 2019, 01:46:01 PM »
I have been attempting to assign the key board keys to certain functions under the Key Board configuration menu. I have been able to to assign the jog functions for each axis but I cannot create any for such things as e-stop, Jog rate %, spindle on/off and so on. The issue I have is in the function column on the Key Board configuration table does not have the functions like e-stop and the others listed so although I can fill in the other columns on the table as desired but the function column lacks, from what I see, most functions other than axis movement functions.
Is there a way to add functions to the column of that table so they can be assigned to a key?
Thanks for reading....

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #1 on: January 27, 2019, 03:30:17 PM »
You can see how its done from this video...

https://www.youtube.com/watch?v=jTzYotLTJkY

DazTheGas
New For 2022 - Instagram: dazthegas

Offline smav

*
  •  55 55
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #2 on: January 27, 2019, 04:45:31 PM »
Thanks Daz for that tip.....I can and have mapped keys to inputs but my question is, how do you assign the input to a function. For example, I have the e-stop push button on my controller/vfd assigned to the emergency or e-stop input so that works as designed but how do I  assign the e-stop function to the keyboard key that I want to use also for the e-stop function?
Thanks again for the tip

Offline smav

*
  •  55 55
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #3 on: January 27, 2019, 04:48:36 PM »
More specifically I assigned the ~ button to input 0. How do I give input 0 the function of e-stopping the machine when activated?
Thanks again for the help

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #4 on: January 27, 2019, 05:03:35 PM »
Use the sigLib script in the screen load script and activate the estop if input0 is pressed

Code: [Select]
[mc.ISIG_INPUT0] = function (state)
    if (state == 1) then   
        mc.mcCntlEStop(inst)
    end
end,

DazTheGas
New For 2022 - Instagram: dazthegas

Offline smav

*
  •  55 55
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #5 on: January 27, 2019, 06:16:08 PM »
Thanks again for the help on that. I copied that code and noticed when I opened the screen load script that the first line was already there so all i had to do was add the other two lines with the end statement and the button initiates the e-stop now. :)

Offline smav

*
  •  55 55
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #6 on: January 28, 2019, 11:37:57 PM »
Ok got the easy functions like e-stop and such figured out on how to map them to a key but I am a little lost on how you would map the keys to feed rate or jog rate. Is there a keyboard plugin that actually has all of the functions in mach 4 that you could just select from a drop? Basically I am lost on how you tell the input or write the a script to increase a DRO like Jog% to increase or decrease from button functions.
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #7 on: January 29, 2019, 09:06:56 AM »
smav,
There aren't any more functions from a drop down other than jogging from the Keyboard Plugin Config.  You will have to add your inputs to the Signal Library just like you did with the E Stop.
The EStop was easy because there is already a call for E Stop; but you will have to write a script to do other functions like increasing Jog %.

I made a script to increase and decrease the Spindle Override with the (+) and (-) buttons.
I mapped the Buttons to Input 3 and Input 4.
In the screen load script; I made a function called SpindlePlus() to increase by 10% and SpindleMinus() to decrease by 10%
In the Signal Library, I put those functions in Input 3 and Input 4 respectively.



[mc.ISIG_INPUT3] = function (State)
    if (State == 1) then   
       SpindlePlus()
     end
end,

[mc.ISIG_INPUT4] = function (State)
    if (State == 1) then   
       SpindleMinus()
     end
end,

---------------------------------------------------------------
function SpindlePlus()
    local inst = mc.mcGetInstance()
    local SSO = mc.mcSpindleGetOverride(inst)--Returns:  0.5 - 1.5
    if SSO >= 1.5 then
       mc.mcCntlSetLastError(inst, "Can't increase SSO anymore.")
    else
       SSO = (SSO + 0.1)
       mc.mcSpindleSetOverride(inst, (SSO))
    end
end
---------------------------------------------------------------
function SpindleMinus()
    local inst = mc.mcGetInstance()
    local SSO = mc.mcSpindleGetOverride(inst)--Returns:  0.5 - 1.5
    if SSO <= 0.5 then
       mc.mcCntlSetLastError(inst, "Can't decrease SSO anymore.")
    else
       SSO = (SSO - 0.1)
       mc.mcSpindleSetOverride(inst, (SSO))
    end
end
---------------------------------------------------------------

Chad Byrd

Offline smav

*
  •  55 55
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #8 on: January 29, 2019, 11:05:12 AM »
Thanks for the info and help on that. I figured it would take a little bit of script in order to do that, wish I was a little handier at writing it. I think I can figure out from the example how to create the jog% function to input from a keyboard key.
Thanks again for the help and advice.

Offline smav

*
  •  55 55
    • View Profile
Re: Configuring Keys In Key Board Inputs Configuration Table
« Reply #9 on: January 31, 2019, 12:36:34 PM »
Chad--I duplicated your example for spindle speed with the code in the screen load script and signal library and it works just as you describe. I then attempted to modify it to do the same, using inputs 1 and 2 to increase and decrease jog rate. There were only a few options such as JogRateAccel, JogRateVelocity and maybe another one that I thought should return a the value from the JogRate% DRO but I don't think any of those actually capture or read what is reflected in the Jog Rate % DRO value. I also attempted to see if I could create a register to capture the JogRate% DRO value and then get it from the register but that didn't work either. What I am trying to figure out is what is the right function call to get the current Jog Rate and the which is the correct one to call to increase or decrease it. I believe the slider and DRO represent the percentage of the motors 0 to full open feed rate. If you or anyone else has any suggestions or directions on which are the correct functions to call for the get and execute commands I would appreciate it. NOTE: Lua is new to me and my programming experience was in basic and VB.
Thanks for the advice and help.