Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Kfischer on February 02, 2022, 07:20:36 PM

Title: Rotator switch for Jog increments
Post by: Kfischer on February 02, 2022, 07:20:36 PM
Okay,

Read a bunch of topics on pendants and assigning buttons in screen4 etc but can't find specifics on assigning mach3 commands for an external rotary switch for Jog increments.

Maybe it's just not possible? (Think it would be with all the fancy pendants out there).

I have a 3 position switch next to my MPGs and just want to switch jog from 1.00, 0.10 and 0.01 increments from the dial.

Dial is a single pole 5V switch.
Wired to ports 7, 8, 9 on a C10 board (run through a ESS from warp9)
And I put buttons on the mach3 MPG screen already. I tried assigning hot keys but no luck.

Also tried searching for vBscript code to put in, but couldn't find what I needed ( and to be honest, don't really have an idea on what I am looking for lol).

Thanks,

Kyle

Photos are attached.
Title: Re: Rotator switch for Jog increments
Post by: Kfischer on February 02, 2022, 07:25:10 PM
Won't let me attach files..
Title: Re: Rotator switch for Jog increments
Post by: Kfischer on February 02, 2022, 07:30:22 PM
Other photo
Title: Re: Rotator switch for Jog increments
Post by: joeaverage on February 03, 2022, 01:22:05 AM
Hi,
do you actually use the switch?

I had previously used a VistaCNC P1A pendant, and it had a switch for changing jog increments....which I hardly ever used. So much so
that I basically wore the pendant out and that switch is still new.

When I made my own pendant I just have a single sprung loaded toggle switch for jog mode. In the normal position it is in Incremental
mode, and I have found that 0.05mm to be almost prefect, fast enough to jog a reasonable distance and yet sufficiently fine to touch off
for anything but the most demanding of jobs. With the switch in the off-normal (sprung) position the machine is in Velocity jog mode,
which is great for traversing big distances....but absolute disaster for touching off, hence releasing the toggle switch and the machine
reverts to the much safer Incremental mode. The switch requires one, just one, signal wire, too easy!

Craig
Title: Re: Rotator switch for Jog increments
Post by: Kfischer on February 03, 2022, 01:25:58 AM
Hi,
do you actually use the switch?

Craig

Hey Craig!

Yep I will, I do some cutting manually with my mpgs. Computer is on the far end of the lathe and walking back and forth to swap is a pain 😂.

The switch is what I got and is fully wired in currently so putting some code in or assigning proper buttons seems the easy route 🤔

Thanks,

Kyle
Title: Re: Rotator switch for Jog increments
Post by: TPS on February 03, 2022, 06:26:58 AM
ok let's make an example

0,01 input is assigned to OEMTrigger(10)
0,10 input is assigned to OEMTrigger(11)
1,00 input is assigned to OEMTrigger(12)

and these three stepp are confgured in Config -> General Config -> Jog Increments

then you create in macros\your profile name a textfile named M300.M1S
then open this file with texteditor and put this code in:

Code: [Select]
SetTRiggerMacro(301)

now go to Config -> General Config -> Initialisazio String and enter M300  at the end of the existing.

then you create in macros\your profile name a textfile named M301.M1S
then open this file with texteditor and put this code in:

Code: [Select]
Sub Main()

  If IsActive (OEMTRIG10) Then
    dooembutton (191)
  End If

  If IsActive (OEMTRIG11) Then
    dooembutton (192)
  End If

  If IsActive (OEMTRIG12) Then
    dooembutton (193)
  End If

End Sub

save the file and restart Mach, and with a little bit of luck it will work.

If M300.M1s and M301.M1s is allready there chose any free number.


Title: Re: Rotator switch for Jog increments
Post by: Kfischer on February 03, 2022, 02:00:21 PM
ok let's make an example

0,01 input is assigned to OEMTrigger(10)
0,10 input is assigned to OEMTrigger(11)
1,00 input is assigned to OEMTrigger(12)

and these three stepp are confgured in Config -> General Config -> Jog Increments

then you create in macros\your profile name a textfile named M300.M1S
then open this file with texteditor and put this code in:

Code: [Select]
SetTRiggerMacro(301)

now go to Config -> General Config -> Initialisazio String and enter M300  at the end of the existing.

then you create in macros\your profile name a textfile named M301.M1S
then open this file with texteditor and put this code in:

Code: [Select]
Sub Main()

  If IsActive (OEMTRIG10) Then
    dooembutton (191)
  End If

  If IsActive (OEMTRIG11) Then
    dooembutton (192)
  End If

  If IsActive (OEMTRIG12) Then
    dooembutton (193)
  End If

End Sub

save the file and restart Mach, and with a little bit of luck it will work.

If M300.M1s and M301.M1s is allready there chose any free number.

Okay, this is promising but didn't work. Likely didn't work cause I don't have a setting proper haha.

In ports and pins what do I assign for the OEM Triggers?

In hot keys what do I assign?

And lastly, the buttons in screen4 are they correct?

I attached photos of each place. The two scripts are in the mach3 turn profile under macros. And I attached a photo of the initialization screen - is that right?

Thanks!

Kyle
Title: Re: Rotator switch for Jog increments
Post by: Kfischer on February 03, 2022, 02:00:48 PM
Last photo.
Title: Re: Rotator switch for Jog increments
Post by: MN300 on February 03, 2022, 05:51:34 PM

Here is my crazy idea for the day, inspired by something Kfischer wrote.
Quote
Yep I will, I do some cutting manually with my mpgs.

It would be possible to use a 2 axis analog joystick and an Arduino to generate two quadrature signals with their speeds proportional to the joystick X and Y positions. If the MACH software can handle two encoder signals at the same time you could drive your spindle in any direction, at a controllable rate.

I played with an Arduino Nano this afternoon and generated a 4000 step per second quadrature signal.
Using Graig's suggested increment of 0.05mm, a 1 cm per second travel speed would only need 200 steps per second.

This looks like an affordable joystick. Better but more expensive ones are available.
https://www.digikey.com/en/products/detail/adafruit-industries-llc/3102/6152821.

Is this just a crazy idea or might someone actually find it useful?

John
Title: Re: Rotator switch for Jog increments
Post by: Kfischer on February 03, 2022, 09:20:05 PM

Here is my crazy idea for the day, inspired by something Kfischer wrote.
Quote
Yep I will, I do some cutting manually with my mpgs.

It would be possible to use a 2 axis analog joystick and an Arduino to generate two quadrature signals with their speeds proportional to the joystick X and Y positions. If the MACH software can handle two encoder signals at the same time you could drive your spindle in any direction, at a controllable rate.

I played with an Arduino Nano this afternoon and generated a 4000 step per second quadrature signal.
Using Graig's suggested increment of 0.05mm, a 1 cm per second travel speed would only need 200 steps per second.

This looks like an affordable joystick. Better but more expensive ones are available.
https://www.digikey.com/en/products/detail/adafruit-industries-llc/3102/6152821.

Is this just a crazy idea or might someone actually find it useful?

John

Would have went with something like this before investing in what I got.

Oh well, gunna make this work and be happy 😊 hahaha.!
Title: Re: Rotator switch for Jog increments
Post by: TPS on February 04, 2022, 01:15:26 AM
to use the system hotkey's is an other way to do this, but you should only use one.
the macro version or the system hotkey version.

the rest looks ok for me, but i can nothing say about your input setting's it is depending on your
hardware connection. maybe they have to be low active, but it dont know.
Title: Re: Rotator switch for Jog increments
Post by: TPS on February 04, 2022, 01:26:40 AM
if i look to this manual:

https://www.cnc4pc.com/pub/media/productattachments/files/c10r11.3_user_manual_ver.2.pdf

there is one jumper to set pin 2-9 as inputs and if you use 5V for the inputs the jumper need's to
set to Pull down and then the inputs must be Low active.

but if you have used pin 2/3/4/5 for step/dir sinals you can not use 7/8/9 for inputs.
Title: Re: Rotator switch for Jog increments
Post by: Kfischer on February 14, 2022, 12:53:15 AM
ok let's make an example

0,01 input is assigned to OEMTrigger(10)
0,10 input is assigned to OEMTrigger(11)
1,00 input is assigned to OEMTrigger(12)

and these three stepp are confgured in Config -> General Config -> Jog Increments

then you create in macros\your profile name a textfile named M300.M1S
then open this file with texteditor and put this code in:

Code: [Select]
SetTRiggerMacro(301)

now go to Config -> General Config -> Initialisazio String and enter M300  at the end of the existing.

then you create in macros\your profile name a textfile named M301.M1S
then open this file with texteditor and put this code in:

Code: [Select]
Sub Main()

  If IsActive (OEMTRIG10) Then
    dooembutton (191)
  End If

  If IsActive (OEMTRIG11) Then
    dooembutton (192)
  End If

  If IsActive (OEMTRIG12) Then
    dooembutton (193)
  End If

End Sub

save the file and restart Mach, and with a little bit of luck it will work.

If M300.M1s and M301.M1s is allready there chose any free number.

Okay got it working.

Mn300 corrected it with the port issues. I moved to inputs 12, 13, 15 with the pull down deal and it registers with your macro!

Thank you.

But one odd thing is. If I cycle forward from 1 to 2 to 3. It goes correctly. But cycling back from 3 to 2 to 1 it won't register 2?

It'll go to 0.1 when I get to 1 from 0.001 but not do anything When on 2 (0.01).

Not that it matters, if I cycle from 3 to 1 then to 2 it registers haha.

Thanks again,

Kyle