Machsupport Forum

Mach Discussion => Brains Development => Topic started by: slow-poke on October 10, 2017, 12:33:57 PM

Title: Brains - Creating a button that sequences through various modes when pushed ?
Post by: slow-poke on October 10, 2017, 12:33:57 PM
I would imagine this is trivial for those that are familiar with creating brains (I'm not, complete newbie)

I'm making a hard button panel (see below), I'm using a Pokeys 57E to capture the key presses. This is working fine, I can jog, etc via the panel.  Setting this up using the pokeys configuration software (Mach3 plug-in) is straight forward, just map one of the 55 input pins to the desired button in mach3 and it works.

Some of the buttons on my panel need to cycle through various modes (bottom left button) for example the SS-CON-MPG. I have this mapped to button call 245 and it works fine, HOWEVER I would like a 4th press of the button to disable jogging, and then if I press again it starts at SS.

Similar situation for the right most blue button, first push MPG is set to Jog speed, 2nd push the MPG controls feed speed and then 3rd push disables the MPG.

Can someone describe how I can create a brain to provide this functionality?
Title: Re: Brains - Creating a button that sequences through various modes when pushed ?
Post by: slow-poke on October 11, 2017, 09:16:38 PM
I'm starting to get the impression that there are less people using "brains" that I envisioned.

The following almost works, it increments and selects, however I have not had any luck resetting OEMDRO: 1501 to 0 or 1 after I get to the desired roll-over count.  I have tried  MANY methods and they all failed. It seems like if you try to write to OEMDRO:1501 in any other rung after the initial instance that the register refuses to update or be set to 0, 1 etc.
 ???
Title: Re: Brains - Creating a button that sequences through various modes when pushed ?
Post by: slow-poke on October 12, 2017, 08:05:17 AM
Working......

I took another (simpler) approach and it works, I just need to add debounce to the inputs