Program stops at this line, any ideas?


Results 1 to 4 of 4

Thread: Program stops at this line, any ideas?

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

    Default Program stops at this line, any ideas?

    Hi guys running some parts today and everything is running fine for several tools and then suddenly stops right after a toolchange and just does nothing. Buttons are still greyed out as if its running, but it just doesnt run the next line. If i halt and restart on that line it runs fine. Any ideas? Here is the code:

    N2540 (M3 TAP DRILL)
    N2550 T5 M06 ( NO. 39 DRILL)
    N2560 (MAX - Z2.)
    N2570 (MIN - Z-.3899)
    N2580 G00 G90 G54 X.4124 Y-3.8976 S5000 M03
    N2590 G43 G94 H5 Z2. M08
    N2600 G98 G83 Z-.3899 R.1 Q.1 F8.5
    N2610 X.55 Y-3.8725
    N2620 X3.7
    N2630 X3.8376 Y-3.8976
    N2640 Y-.4724
    N2650 X3.6 Y-.4975
    N2660 X.4124 Y-.4724
    N2670 X.7 Y-.4975
    N2680 G80 M09
    N2690 G0
    N2700 M05
    N2710 M100
    N2720 G0 G90 G53 Z0.
    N2730 G54
    N2740 M01
    N2750 (M3 TAP)
    N2760 T6 M06 (M3 X .5MM TAPRH)
    N2770 (MAX - Z2.)
    N2780 (MIN - Z-.51)
    N2790 G00 G90 G54 X.4124 Y-3.8976 S600 M03
    N2800 G43 G94 H6 Z2. M08
    N2810 G98 G84 Z-.51 R.1 Q.22 F.0197
    N2820 X.55 Y-3.8725
    N2830 X3.7
    N2840 X3.8376 Y-3.8976
    N2850 Y-.4724
    N2860 X3.6 Y-.4975
    N2870 X.4124 Y-.4724
    N2880 X.7 Y-.4975
    N2890 G80 M09
    N2900 G0
    N2910 G94
    N2920 M05
    N2930 M100
    N2940 G0 G90 G53 Z0.
    N2950 G54
    N2960 M01

    Its stopping on line 2790. I included the code from previous tool, format is basically identical and that runs fine?? Stops in the same place every part.

    Similar Threads:


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

    Default Re: Program stops at this line, any ideas?

    Looks like the problem was with my machine and not with Kmotion. My high range tensioner wasnt retracting all the way after going into low range. And my M3 program was just sitting there waiting for the conformation signal.

    I should probably add some time limits and error messages to these while loops. Anybody know if theres an example program already done on displaying an error if in a while loop for a certain period of time? Something that could be easily added to this code that caused the problem on my machine:

    Code:
    if (!ReadBit(154) && ReadBit(156) && (spd <= 2300)) // stopped, in high range and s less than or equal to 2300
    	{
    		ClearBit(156); // disengage high
    		SetBit(157); // engage low
    		while (!ReadBit(1041)) // wait for high idler home signal
    		{
    		WaitNextTimeSlice();
    		}
    		SetBit(154); // spindle on cw
    		SetBit(159); // Turn on air seal
    	}




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

    Default Re: Program stops at this line, any ideas?

    You might try an approach like this:

    Code:
    include "KMotionDef.h"
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    
    main()
    {
        double TF = Time_sec() + 3;  // timeout in 3 seconds
    
        while (ReadBit(46))  // wait for something to happen
        {
            if (Time_sec() > TF)  // Timed out?
            {
                if (MsgBox("Tool Change Timeout.  Halt?", MB_YESNO | MB_ICONEXCLAMATION) == IDYES)
                {
                    DoPC(PC_COMM_HALT);
                    return 0;  //exit program
                }
                else
                {
                    TF = Time_sec() + 3;  // continue and timeout after 3 seconds
                }
            }
        }
    }
    Regards

    Regards
    TK http://dynomotion.com


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

    Default Re: Program stops at this line, any ideas?

    That code works perfectly Tom. Still running machine with the tensioner problem till i get this job done and now it tells me exactly whats wrong. Thanks.



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

Program stops at this line, any ideas?

Program stops at this line, any ideas?