Setting up Feed, Rapid and Spindle override with potentiometers... - Page 2


Page 2 of 4 FirstFirst 1234 LastLast
Results 13 to 24 of 37

Thread: Setting up Feed, Rapid and Spindle override with potentiometers...

  1. #13
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    356
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Quote Originally Posted by Need TECH Help! View Post
    Hi Tom,

    So far iam able to issue a Feed Hold when any override is below a certain amount but cant get a resume action to happen when override is above a certain amount, I must press my CycleStart button to resume, which isn't bad but would be better if the resume action would happen when override pot is turned back up a certain amount. There is also a conflict with the behavior of my physical CycleStart and FeedHold button.
    Should the code that would issue a stopcoordinatedmotion command be with the part of code that handles my physical Start and Feed hold buttons? I tried doing this but could not figure it out.


    Ahh, ok, that's what the setting in the Feed Rate Override is for on the Trajectory Planner Tab. One of those settings I never gave any thought about what it might do.

    Command FRO of 0 causes a pop up stating Enter a value between .1 and 2. Which now that iam using override pots, can this pop up be turned off?

    I have attached my current INIT code.

    Thanks,
    Troy
    Hi Troy,

    if (FRO < .03) FRO = StopCoordinatedMotion(); should be:
    if (FRO < .03) StopCoordinatedMotion();

    But you would also need to set a variable or bit upon stopping and check for this variable AND the pot being set higher to resume. Toms way is alot easier and makes more sense. If you can get past the popup, Just use:

    if (FRO < .03) FRO = 0;

    Good luck with it.

    Mark



  2. #14
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    441
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I tried using :
    if (FRO < .03) FRO = 0;
    nothing seems to change when override reaches .03.

    Troy

    http://www.homecncstuff.elementfx.com/


  3. #15
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    356
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    No it wont actually show a feed hold or anything this way, but it should stop moving completely. You removed the stopcoordinatedmotion line right? All you will need this way is just the one line:
    if (FRO < .03) FRO = 0;

    If your still having trouble for some reason and want to try the other way id probably try something like this:
    Code:
    if (FRO < .03 && !ReadBit(xx))             	// If FRO below 0.03 and not already stopped
    	{
    	StopCoordinatedMotion();	       // Stop
    	SetBit(xx);		                 // Set bit to indicate stopped by pot
    	}
    
    if (FRO > .04 && ReadBit(xx))             	// If FRO above 0.04 and stopped by pot
    	{
    	ResumeCoordinatedMotion();	        // Resume
    	ClearBit(xx);	                        // Clear bit to indicate stopped by pot
    	}
    This should apply a proper feedhold and then remove it when you increase the pot. You will have to enter some number in place of XX for an unused bit. I think there is a range of numbers that can be used for things like this that are not used for any inputs and outputs but im not sure what they are, maybe Tom can help with that. Any unused output number should work fine as well to test.



  4. #16
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2991
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    It isn't clear whether you expect the sliders on the Screen to show or work properly. This is always a problem with multiple ways of setting things.

    For right or wrong KMotionCNC ignores FRO commands less than 0.001. Also the Slider and Feedrate edit control have a limited range down to 0.1.

    So much like Mark suggested I tried the code below and it seems to work reasonably well. What is sent to KMotionCNC is limited to 0.1. But below that a Feedhold is issued and PotSetFeedhold remembers that we did this so we can resume when the level goes above 0.1.


    Code:
        BOOL PotSetFeedhold=FALSE;
        
        for (;;)                    // loop forever
        {
            T = WaitNextTimeSlice();
            Pot1 = (double)KANALOG_CONVERT_ADC_TO_VOLTS(ADC(0));
            Pot2 = (double)KANALOG_CONVERT_ADC_TO_VOLTS(ADC(1));
            Pot3 = (double)KANALOG_CONVERT_ADC_TO_VOLTS(ADC(2));
            FRO = Pot3 * 0.217;
            FRO = persist.UserData[9] * 0.001;
            RAPIDO = Pot2 * 0.117;
            SSO = Pot1 * 0.17;
    
            if (FRO <= .1)
            {
                FRO = 0.1;
                StopCoordinatedMotion();
                PotSetFeedhold = TRUE;
            }
            else if (PotSetFeedhold)
            {
                ResumeCoordinatedMotion();
                PotSetFeedhold = FALSE;
            }
    Will this work for you?



  5. #17
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    441
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I have the sliders hidden so don't need them.
    Will give the code a go tonight.
    Thanks,
    Troy

    http://www.homecncstuff.elementfx.com/


  6. #18
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    441
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I tried adding your above code to my main init and there is no response when I change potentiometer. The Feed Rate box stays at 2 no matter what position the potentiometer is at. I most likely inserted code wrong.

    Attached is my main init with new code.

    Troy

    Attached Files Attached Files
    http://www.homecncstuff.elementfx.com/


  7. #19
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2991
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I’m sorry. Please remove this line that I was using to simulate the pot value.

    FRO = persist.UserData[9] * 0.001;



  8. #20
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    441
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Tom,
    Thats the problem with being a copy and paste person like me, i dont really understand just how the code works. I do at times pick up something tho That said i was able to get all 3 overrides to issue a FeedHold when set to minimum. But now during a Gcode program run ,with Spindle running, my physical CW,CCW and Off buttons do not operate spindle but the keyboard hotkeys F9,F10 and F11 do work. Does this mean that the c code i added is not allowing the rest of c code to work?

    Attached is update INIT.

    Thanks again for support Tom,
    Troy

    Attached Files Attached Files
    http://www.homecncstuff.elementfx.com/


  9. #21
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2991
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I'm not sure why that would be. Were they working before the change?

    Can you provide all the details so we can try to duplicate. Your Screen Script? How M3,M4,M5 are configured? Any Spindle Programs?



  10. #22
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    441
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Tom,
    Just checked with a INIT program before i added pots and the physical Spindle buttons do not work when a Gcode is running or in FeedHold, but when Gcode is not running the physical buttons work fine.Again, the keyboard hotkey buttons for spindle F9,F10,F11 do work when Gcode is running. So problem was before adding pots. Attached is my 3 screens and my c programs for M3,M4,M5 and the rigid tapping c code.
    Testing Gcode is simple....
    G20
    M3S500
    G01 X-.5 F10.
    G01Z-10.F10
    G01Z0F10
    G01X0.
    M30

    Let me know if there is something else you might need that i did not include.
    Thanks,
    Troy

    Attached Files Attached Files
    http://www.homecncstuff.elementfx.com/


  11. #23
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    356
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I guess kmotioncnc is not allowing the M codes to be sent while a job is running. Instead of your init file sending an M code after pushing physical buttons, consider copying the M3/4/5 code directly into the init file. Should work that way.

    Glad you got the pots working the way you want. Isnt it awesome how we can get just about anything to work exactly how we want with just a few lines of code?

    Mark



  12. #24
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2991
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    Mark is correct. For safety reasons KMotionCNC rejects requests of MCodes or User Buttons while a Job is running. Maybe we should have an option to override this. Copying the code that eventually needs to execute should work and actually be faster and more reliable as it wouldn't depend on the PC. Shame to have duplicated code though. You could put the functions in an include file.

    We are working on new Screen Script functionality that might also solve this. Where Screen Script can push a screen button or a keyboard button. Also the ability for KFLOP to command KMotionCNC to execute Screen Script (without pushing a User Button to do so).



Page 2 of 4 FirstFirst 1234 LastLast

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

Setting up Feed, Rapid and Spindle override with potentiometers...

Setting up Feed, Rapid and Spindle override with potentiometers...