Hello Guest it is April 30, 2024, 07:34:11 AM

Author Topic: Why this VB code works in the script editor but not when button is pressed?  (Read 5568 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarak

*
  •  229 229
    • View Profile
All I'm trying to do is ensure that when RESET is pressed the spindles and coolant all turn off.
I have 4 spindle relays and 1 coolant relay.
It's really strange how this code works in the script editor but not when run from Mach, it presses the RESET button once and then I cannot re-enable the system???

Here's the code I have for the RESET button (M22)
'TURN OFF SPINDLE & COOLANT RELAYS THEN ESTOP THE SYSTEM
CODE "M16" 'Turn off all Spindle Relays
CODE "M19" 'Turn OFF Coolant

DoOEMButton(1021)'Press RESET

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Why this VB code works in the script editor but not when button is pressed?
« Reply #1 on: September 16, 2007, 10:43:33 PM »
why do it the hard way, just use one of the Enable lines and "AND" the line into the power of the relays, so when you reset the enable goes off.........
fun times

Offline Tarak

*
  •  229 229
    • View Profile
Re: Why this VB code works in the script editor but not when button is pressed?
« Reply #2 on: September 26, 2007, 07:57:38 PM »
Hi Scott, you were right I just used the relay enable on the CNC TekniX controller card, so when RESET is pressed it automatically takes out all the outputs.
The only problem I have is, when I ready the system again the screen says the spindle and coolant is still on (LED's), even though they are not.
How do I make it reset the led's on the screen, when RESET is pressed?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Why this VB code works in the script editor but not when button is pressed?
« Reply #3 on: September 26, 2007, 09:13:03 PM »
here is a brain that should do it, but, when I reset on mine, it turns off the spindle led, and coolent led.

scott
« Last Edit: September 26, 2007, 09:14:44 PM by poppabear »
fun times

Offline Tarak

*
  •  229 229
    • View Profile
Re: Why this VB code works in the script editor but not when button is pressed?
« Reply #4 on: September 27, 2007, 06:59:58 PM »
Thanks Scott, that did the trick nicely.

Offline Tarak

*
  •  229 229
    • View Profile
Re: Why this VB code works in the script editor but not when button is pressed?
« Reply #5 on: September 27, 2007, 09:46:55 PM »
I tried this brain on my normal computer, it works great, but when I copy it to the machine computer (all have the same files & v2.48).
It won't operate the brain correctly, it's got me knackered.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Why this VB code works in the script editor but not when button is pressed?
« Reply #6 on: September 27, 2007, 11:51:48 PM »
you need to update mach, that brian was for 2.49+
fun times

Offline Tarak

*
  •  229 229
    • View Profile
Thanks Scott

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
k,

BTW: When you gonna put out some more screens?

Scott
fun times

Offline Tarak

*
  •  229 229
    • View Profile
Yeah, I've been lazy, too many things on the go, I should probably finish them.