Hello Guest it is March 28, 2024, 04:21:22 PM

Author Topic: Suffering From Brain Damage....  (Read 9198 times)

0 Members and 1 Guest are viewing this topic.

Suffering From Brain Damage....
« on: August 18, 2008, 08:54:45 PM »
Today I built myself the worlds cheapest pendant, using an old video game controller.  I had no trouble getting most of the buttons to do what I wanted, but a few are giving me fits. 

I have been able to set two buttons to increase/decrease jog %, using the "Inc Jog %" and "Dec Jog %" "button presses", but this doesn't really do quite what I want.  I'd really like to have a single button that acts as a toggle between step and continuous jog modes, and two other buttons that move up or down a lpre-defined ist of jog rates or step sizes, depending on the mode the first button has set the jog mode to.  I tried doing a simple toggle of jog rate between 10% and 100%, but the problem is it continuously toggles back and forth between 10% and 100% for as long as the button is pressed.  How do I get it to generate only a single "button press" event to Mach for each press of the pendant button?

Regards,
Ray L.
Regards,
Ray L.

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Suffering From Brain Damage....
« Reply #1 on: August 18, 2008, 10:48:30 PM »
Ray, How are you setting the gamepad up? In keygrabber?

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Suffering From Brain Damage....
« Reply #2 on: August 18, 2008, 11:07:15 PM »
Brett,
    No, it's plumbed to a parallel port.  I had an old Microsoft PC game controller that has a "joypad" and 11 switches - all digital.  I stripped the chip and discretes off the board, and just wired all the switches to my second parallel port (I have a few switches left over....), and configured them all to OEM "triggers".  The functionality is all implemented in brains.  The joypad obviously serves as a jog controller (jog X left/right, jog Y left/right).  I setup some of the other switches as E-stop, Program Run, Zero All Axes, Inc. Jog % and Dec. Jog %. 

Regards,
Ray L.
Regards,
Ray L.
Re: Suffering From Brain Damage....
« Reply #3 on: August 19, 2008, 12:39:19 AM »
OK, *maybe* I've answered my own question, but I'm not at the machine, so can't test it right now.  Here's an approach I think should work:

;; If OEM4 button is pressed, and current Jog % is below 30%, then set V0 to 30%
V0 = (~OEMInput4 && (Jog%DRO < 30)) * 30
;; If OEM4 button is pressed, and current Jog % is between 30% and 50%, then set V0 to 50%
V0 = (~OEMInput4 && (Jog%DRO >= 30) && (Jog%DRO < 50)) * 50
;; If OEM4 button is pressed, and current Jog % is between 50% and 75%, then set V0 to 75%
V0 = (~OEMInput4 && (Jog%DRO >= 50) && (Jog%DRO < 75)) * 75
;; If OEM4 button is pressed, and current Jog % is between 75% and 100%, then set V0 to 100%
V0 = (~OEMInput4 && (Jog%DRO >= 50) && (Jog%DRO < 75)) * 100
;; If OEM4 button is pressed, and current Jog % is 100, then set V0 to 10%
V0 = (~OEMInput4 && (Jog%DRO = 100)) * 10

;; If OEM4 button is *not* being pressed, copy V0 to Jog % DRO
Jog%DRO = OEMInput4 * V0

I hope this makes sense.  Is there a better way to do this?

I don't suppose the format of the brain files is documented?  I'd love to write a Perl parser that would take a text-based brain description (similar to the above) and output a binary brain file.

Regards,
Ray L.
Regards,
Ray L.
Re: Suffering From Brain Damage....
« Reply #4 on: August 19, 2008, 02:53:41 PM »
OK, so that was a total disaster.  Locked the machine up solid, again.  I think I'm starting to understand how these things work, and it seems rather limiting, if I'm right.  Each "lobe" get evaluated any time *any* input changes.  If the result of the evaluation is true, then that is passed on to the next lobe.  What's got me stumped is how to effect changes that cause, directly or indirectly, an input to the brain that initiated the change.  This causes a loop, which locks up Mach3.  Also, I'd like to know how, if possible, to pass through a value, from a DRO etc., which is enabled by a logic condition.  For example, what I'm really trying to do here is look at the current value of Jog%DRO, decide what I want the new value to be, and set that.  But, doing that creates a loop, as Jog%DRO is both an input and an output to/from the same brain.  I've yet to find a way to make this work.  I suspect the "latch" lobe may help here, but I can't figure out what it does, or how to use it.  Seems like it could be used to "hold" an input value, to prevent it from changing while the brain is active, so the brain won't see the updated value it just wrote to the output/DRO/whatever.
Brains would be a helluva lot more useful if there were some documention that explains how they really work.  Having to figure it out by experimentation is very frustrating, and time-consuming.

Regards,
Ray L.
Regards,
Ray L.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Suffering From Brain Damage....
« Reply #5 on: August 30, 2008, 05:28:12 PM »
Ray,

  Use TWO brains, one that is your input condition brain, in your case you %jogDRO, and write that to a user dro, or set a logic condition LED.

BTW: It would help GREATLY if you would explain exactly what and how you want to do the brain and why.............

In the second Brain, pull in the user dro value, and work your formula or formula(s), in single or multiple rungs depending on what you want to do.

scott
fun times
Re: Suffering From Brain Damage....
« Reply #6 on: September 01, 2008, 10:52:29 AM »
Ray,

 Use TWO brains, one that is your input condition brain, in your case you %jogDRO, and write that to a user dro, or set a logic condition LED.

BTW: It would help GREATLY if you would explain exactly what and how you want to do the brain and why.............

In the second Brain, pull in the user dro value, and work your formula or formula(s), in single or multiple rungs depending on what you want to do.

scott

Scott,

    I tried doing basically what you suggested, but using a variable rather than a user DRO.  Does that matter?  I basically set it up so a falling edge on a pendant button (button pressed) would trigger a brain that looked at the current setting of a parameter, such as jog %, and set a variable to the desired new value.  Another brain watched for a rising edge on the same pendant button (button released), and set jog % to the value in the variable.  This still resulted in a loop that locked the machine up solid.
    "BTW: It would help GREATLY if you would explain exactly what and how you want to do the brain and why............." - I believe I did that in great detail in my first post in this thread....

Regards,
Ray L.
Regards,
Ray L.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Suffering From Brain Damage....
« Reply #7 on: September 01, 2008, 11:36:40 AM »
post up your brains here and I will look at them........
fun times
Re: Suffering From Brain Damage....
« Reply #8 on: September 01, 2008, 06:26:04 PM »
post up your brains here and I will look at them........

Well, I'd have to recreate them.  I didn't save the ones that didn't work.

Regards,
Ray L.
Regards,
Ray L.
Re: Suffering From Brain Damage....
« Reply #9 on: May 10, 2012, 11:32:15 AM »
take your first brain and add a one shot timer to the button press ( set the interval to 0.1 sec )- that way it only executes once no matter how long you hold the button down