Code for Init File to Halt all other running threads?


Results 1 to 3 of 3

Thread: Code for Init File to Halt all other running threads?

  1. #1
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Code for Init File to Halt all other running threads?

    Hi Tom,

    Im running into an occasional mechanical issue with my toolchanger and its triggering an Estop. My toolchange program is still running and In order to recover I need to open up kmotion and halt that thread.

    I would like to be able to recover the machine just by restarting init file. Have the beginning of the init file stop all running threads. Looks like I need to use the Kill command for whatever threads Im using? Like this:

    Kill4
    Kill6

    Or would it be

    Kill4;
    Kill6;

    Or something else? Should I add a delay after this to be sure those threads are stopped before clearing bits to be sure all the toolchanger outputs are off? Thanks.

    Mark

    Similar Threads:


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4043
    Downloads
    0
    Uploads
    0

    Default Re: Code for Init File to Halt all other running threads?

    Hi Mark,

    You can use:

    PauseThread(4);
    PauseThread(6);

    No delay should be required. Once those routines return the corresponding Thread will not execute further.

    Another approach would be to have the Threads detect the error, do any cleanup, and terminate itself (exit). Probably not in your case, but killing Threads sometimes has a possibility of leaving things in a partially changed invalid state.

    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Code for Init File to Halt all other running threads?

    Quote Originally Posted by TomKerekes View Post
    Hi Mark,

    You can use:

    PauseThread(4);
    PauseThread(6);

    No delay should be required. Once those routines return the corresponding Thread will not execute further.

    Another approach would be to have the Threads detect the error, do any cleanup, and terminate itself (exit). Probably not in your case, but killing Threads sometimes has a possibility of leaving things in a partially changed invalid state.
    Thank you Tom I will try that. I think it would be much trickier to get the toolchange program to detect the error and set everything properly. The e stop actually comes from a switch being watched in my init file, not a specific step of toolchange program.

    My machine has a sensor to trigger Estop if somehow the whole toolchanger mechanism gets pulled up or down. Say the tool fails to release, and drawbar sensor also fails and the machine starts to pull the whole toolchanger assembly up, it will detect this and shut things down. Same if the toolchanger happend to get bumped on the way down somehow.

    The problem Im having is toolholders sticking in the spindle from heavy cutting and when they finally let go, they have so much force behind them that the shock is tripping this sensor. This should work fine for what im doing.



Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Code for Init File to Halt all other running threads?

Code for Init File to Halt all other running threads?