Hello Guest it is March 28, 2024, 12:46:11 PM

Author Topic: Need script help  (Read 2837 times)

0 Members and 1 Guest are viewing this topic.

Need script help
« on: April 26, 2009, 09:06:44 PM »
HI I am having trouble with the logic of this little button code.

dooembutton(1001) 'do a pause
While getoemdro(813)>0 'wait for blended velocity to stop
Wend
dooembutton(1003)  'stop
dooembutton(1002)  'rewind

The while/Wend loop was an effort to get the pause function to complete before passing on to the stop function.

I would like one button to do a "pause" then a "stop". This snippet worked in the simulator, but on a machine what ever line is executing when the button is pressed continues till its done and THEN it "stops".

Tried IsMoving() same results.

Any ideas on how to properly get the "pause" to completely execute before moving on to the "stop"?

Thank you.
Jim

Offline jimpinder

*
  •  1,232 1,232
  • Wakefield, West Yorks, UK
    • View Profile
Re: Need script help
« Reply #1 on: April 30, 2009, 02:33:13 PM »
This caused me a bit of grief, but I think I have worked it out - although I can't quite envisage how you want to use it.

Have you got all this code on a single button?

If so, then when you press "pause" the machine jumps from the GCode program to your VB program (on the button) after it has finished the line that is executing. So it makes the jump. The axis have stopped moving therefore the While/Wend is satisfied, and it moves straight to the Stop.

I still can't understand the logic of what you are trying to do, however, can you expand a bit - while do you need to pause before stopping
Not me driving the engine - I'm better looking.
Re: Need script help
« Reply #2 on: April 30, 2009, 09:35:10 PM »
Hi Jim.
Yes all the code is under one button.
The thing is that when you press stop alone it loses pulses and therefore position. The pause seems to decelerate it before stopping the movement allowing the buffer to empty normally not losing any ticks.
I like the reset button to put the machine in a particular state, (no offsets, g54,g90,g21,etc,etc) and for the sake of the above mentioned machine position want to stop any movement appropriately before resetting all those states should the button get arbitrarily pressed during cycle execution. (kind of muddy explanation).
Currently a pause button push then a reset button push works just fine. Just wanted to be under one button so I dont have to tell every operator to push pause before reset else machine will need rehoming.
Thanks
Jim

Offline jimpinder

*
  •  1,232 1,232
  • Wakefield, West Yorks, UK
    • View Profile
Re: Need script help
« Reply #3 on: May 03, 2009, 11:25:00 AM »
What happens on the real machine if you just ignore the "stop".  Say use an M1 instruction, then just rewind.

The problem with "stop" is that it is designed to be just that - STOP - and it literally slams the brakes on everything to avoid damage to anything. I would try and rewrite it without using a stop. Perhaps M30 has the same effect - that is end of code and rewind as far as I can remember.
Not me driving the engine - I'm better looking.