Hello Guest it is March 29, 2024, 07:38:28 AM

Author Topic: Mapping Mach Functions To My Keyboard  (Read 3809 times)

0 Members and 1 Guest are viewing this topic.

Mapping Mach Functions To My Keyboard
« on: December 13, 2009, 10:21:41 PM »
I am having some trouble mapping my everyday functions to my keyboard. I currently have buttons hidden in my screen set with my hotkeys setup but these few I dont know how to make work correctly:

1) Spindle Stop, is it OEM Code 182 (??? Toggle Spindle Actual)
2) Flood/Mist I want to have a coolant off button but I see no OEM code for that, Only way I can think of it is to use 'G-Code Function' and call a macro that does OEM Codes 225 & 227. OR use the VB Script button but im not sure how to tie a script to that button.
3) I want a Retract Z in my job control for easy checking of things such as surface finish or clearing out chips/islands do I need to write a macro for this as well or is their a code already?
4) The big daddy question, I want to have jog control setup as my picture says but I dont know how to select what axis the mpg effects.

Cycle axis controlled by MPG 1   175      cycles with one button while
Select encoder jog on axis X     259      should allow me a button for each axis

but neither of these buttons are doing anything....

5) what other shortcut buttons do you guys find very handy when running jobs? I think I have everything I usually use but usually don't remember things until i'm in the middle of working.
6) I want to write a VB script that takes a sequence of keyboard strikes in and translates it to mpg pulse and mpg direction (Im going to wire a digikey encoder to two unused keys and replace the scroll wheel with a mini mpg) I have experience with c for microcontrollers but have no idea how to get keyboard input from mach's vb scripts. Anyone know a good post with some examples?

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mapping Mach Functions To My Keyboard
« Reply #1 on: December 14, 2009, 05:29:25 AM »
1) Spindle Stop, is it OEM Code 182 (??? Toggle Spindle Actual)

Spindle CW Toggle is OEM 110, if spindle is on this will switch off and vice versa.
 
2) Flood/Mist I want to have a coolant off button but I see no OEM code for that, Only way I can think of it is to use 'G-Code Function' and call a macro that does OEM Codes 225 & 227. OR use the VB Script button but im not sure how to tie a script to that button.
There is OEM 113 which is Flood Toggle and OEM 114 which is Mist toggle, as above it will switch On if Off and Off if On.

3) I want a Retract Z in my job control for easy checking of things such as surface finish or clearing out chips/islands do I need to write a macro for this as well or is their a code already?

I have a G Code button on my screen that will move the axis to Z10 (mm) which I use all the time. You could do that and set a HotKey to it and it will work fine. Personally I dislike HotKeys and have external buttons but thats just my preference.

4) The big daddy question, I want to have jog control setup as my picture says but I dont know how to select what axis the mpg effects.
 
Cycle axis controlled by MPG 1 175      cycles with one button while
Select encoder jog on axis X   259      should allow me a button for each axis
 
but neither of these buttons are doing anything....


OEM 174 will toggle between Keyboard Jog and MPG

OEM 303 is MPG Velocity mode
OEM 304 is MPG Step mode
OEM 305 is MPG Multistep mode

OEM 185 will swap to X axis for MPG
OEM 186 will swap to Y axis for MPG
OEM 187 will swap to Z axis for MPG
OEM 188 will swap to A axis for MPG
OEM 189 will swap to B axis for MPG
OEM 190 will swap to C axis for MPG

5) what other shortcut buttons do you guys find very handy when running jobs? I think I have everything I usually use but usually don't remember things until i'm in the middle of working.

As said above I dislike keyboard shortcuts and prefer real buttons, to me keyboards are for entering Data and real buttons are for switching. That however is just my opinion and I can see why others like keyboard shortcuts, especially when they are on machines that are not in an industrial environment.


6) I want to write a VB script that takes a sequence of keyboard strikes in and translates it to mpg pulse and mpg direction (Im going to wire a digikey encoder to two unused keys and replace the scroll wheel with a mini mpg) I have experience with c for microcontrollers but have no idea how to get keyboard input from mach's vb scripts. Anyone know a good post with some examples?
 

Sorry cant help on that other than to suggest you use two inputs on a Parallel Port and input the encoder directly.

Hood
Re: Mapping Mach Functions To My Keyboard
« Reply #2 on: December 14, 2009, 09:03:22 AM »
Hey, thanks for the codes I was hoping their was a global off for spindle and coolant but I guess I will need to macro my own button. This is easy for coolant as their are Mist off (227) and Flood Off (225) but if I toggle both spindle CW and CCW it will just cause the spindle to reverse direction.... Maybe I will script CW and CCW so I can have a variable and know which one to toggle...

It seems you really like hardware buttons, I am planning on having a console setup with wired switches and such but for the meantime shortcuts will serve me fine and the console is going to have the same buttons eventually anyways. I got this keyboard for dirt cheep and it works great considering its a chinese knockoff. I would prefer to have the MPG wired to a printer port or the pokeys eventually but then its tethered to my controller cart, the whole point of my keyboard setup is so that I can move around as 90% of the time I rip and trip on cords...

Thanks.
Re: Mapping Mach Functions To My Keyboard
« Reply #3 on: December 16, 2009, 12:04:46 AM »
Hey how do I add a VB script to a button in Screen4??? In screen designer theirs a textbox for input but not in Screen4.

Ill do something like this:

dim Spindle = 1           '0 = Off, 1 = CW, 2 = CCW
if (Spindle == 1) doButton(110)   'Run CW
if (spindle == 2) doButton(173)    'Run CCW
if (Spindle == 0 & getLED(164)) doButton(110)    'Toggle CW Off
if (Spindle == 0 & getLED(165)) doButton(173)    'Toggle CCW Off
« Last Edit: December 16, 2009, 12:17:16 AM by iceblu3710 »

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mapping Mach Functions To My Keyboard
« Reply #4 on: December 16, 2009, 02:22:25 AM »
You set it as a VB button in Screen4 but you enter and edit VB buttons from Mach, Operator menu then Edit VB Buttons.
Hood