587,478 active members*
3,440 visitors online*
Register for free
Login
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2008
    Posts
    28

    How can I stop the spindle ?

    We have a machine that runs in a production environment, and we have sorted bespoke screens which are working well in the main. One problem is the button code to interrupt the process sometimes doesn't stop the spindle on the first press. Pressing it again will stop it though !
    Code is as follows, and I've tried M5 or DoSpinStop() directly -

    DoOEMButton(1004) 'toggle single step
    While Ismoving()
    Sleep 50
    Wend
    DoOEMButton(1004) 'back to normal operation
    DoOEMButton(233) ' lock doors
    Code "G0 G53 Z0" 'z axis up to safe height
    Code "G0 G53 X0 Y0" 'retun to machine zero
    While Ismoving()
    Sleep 50

    Wend

    DoSpinStop() 'stop spindle
    Code "M421" 'unblock wp selection buttons

    While Ismoving()
    Sleep 50

    Wend
    Code "M30" 'end script and return to start

    DoOEMButton(234) 'open doors
    IF GetOEMLED(82) =1 Then 'if single step active
    DoOEMButton(1004) 'toggle single step

    End If

    Any ideas ? Tim

  2. #2
    Join Date
    Jan 2006
    Posts
    43
    May sound dumb but, you might try to put a pause after the wend command. I think it is a timing issue. The other thing you might just try, is to put the command in two times and see if it works. This would not be a real fix but just to see it it solves it. Good Luck

  3. #3
    Join Date
    Mar 2003
    Posts
    4826
    I don't know anything about Mach, but I have written some logic for a Camsoft retrofit.

    I came to rationalize that sometimes, soft logic that relies on detecting a condition of motion (true or false) can be flakey. I do not know if Windows is too busy and ignores some logic, or if the sample period to detect (stopped motion) is too short, or perhaps the means of detecting stopped motion is itself poorly written detection.

    It may help to create logic in the input/output area, that sets a definite flag when a spindle condition has been fulfilled. You might imagine a series of flag interlocks that detect on, off, forward, reverse, and set opposing pairs of flags to enforce the status of the machine.

    Then, other logic that depends on the function from I/O, looks at the status of the flag variables before execution of the main logic is allowed to continue. This, in turn, permits one to look for a change in status of the flag variable to see if the logic is running correctly: no change, when there should be change, would mean there is a logic problem probably in I/O.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  4. #4
    Join Date
    Mar 2003
    Posts
    35538
    Have you asked on the MachSupport forum?
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  5. #5
    Join Date
    Sep 2008
    Posts
    28
    Thanks for the suggestions - it's quite a curious one. Pressing the button a second time after the button has been pressed to interrupt the program and return the head to machine zero (which it does) the spindle will stop.
    I don't have any further time, so have found a workaround by setting the spindle speed to zero (M3 S0). This seems to work fine.
    Obviously when the operator opens the doors the e-stop circuit trips and turns everything off, so it's not desperate !

    I may ask in the mach forum just for interest.

    Tim

  6. #6
    Join Date
    Feb 2005
    Posts
    487
    Hey time a call to stop the spindle has a decel curve involved, so you need a while is moving call to wait for the decel to happen before moving on in your script.

    Try this:

    DoSpinStop() 'stop spindle
    While Ismoving()
    Sleep 50
    Wend

    Code "M421" 'unblock wp selection buttons
    While Ismoving()
    Sleep 50
    Wend

    this will give the spindle decel time a chance to move to zero before the VB executes down further. On motion code, it is sometimes best to put a whild ismoving after each call.

    If that doest work for you, then "Repeat" the DoSpinStop call with the while is moving as the next block of code below the first one.

    scott
    Commercial Mach3: Screens, Wizards, Plugins, Brains,PLCs, Macros, ATC's, machine design/build, retrofit, EMC2, Prototyping. http://sites.google.com/site/volunteerfablab/

  7. #7
    Join Date
    Jan 2006
    Posts
    43

    i Agree

    Isn't that what I said... just with much more detail... I Still think it is a timing issue.

Similar Threads

  1. how to stop spindle in emergency
    By Joe Miranda in forum Milltronics
    Replies: 7
    Last Post: 04-11-2008, 02:03 PM
  2. spindle work stop
    By gromit68 in forum Haas Lathes
    Replies: 1
    Last Post: 10-26-2007, 10:59 PM
  3. VMC-15: Spindle Would Not Stop !
    By StormWerkz in forum Fadal
    Replies: 8
    Last Post: 04-25-2007, 05:30 PM
  4. Spindle Motor Stop
    By rweatherly in forum Mach Software (ArtSoft software)
    Replies: 3
    Last Post: 11-25-2006, 05:28 PM
  5. Fanuc 0 M - Spindle Stop
    By Uncle Buck in forum Fanuc
    Replies: 2
    Last Post: 07-01-2006, 12:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •