I found this bit of info Tool Setup Trajectory Planner. My spindle encoder now shows RPM readout in KMotionCNC. Now, what needs to be done so i can do rigid taping?
Troy
Ok, now iam back to Spindle Encoder. It is connected to Kanalog JP1. Kmotion.exe shows counts when i rotate spindle.
Is there an example for a Spindle with an encoder? Is the spindle configured to be a Closed Loop axis with infinite error? And how is the RPM displayed in KmotionCNC?
Troy
www.tsjobshop.com, www.homecncstuff.elementfx.com
I found this bit of info Tool Setup Trajectory Planner. My spindle encoder now shows RPM readout in KMotionCNC. Now, what needs to be done so i can do rigid taping?
Troy
www.tsjobshop.com, www.homecncstuff.elementfx.com
Thanks for posting that Troy, i didnt realize it was that easy to get actual rpm readout in kmotioncnc. I will add this to my machine next time i get a chance.
Rigid tapping is done by a C program that has to be custom matched to your machine. Standard fanuc code is used, G98 G84 Z-1. R.1 Q.1 F.0625 for example. You execute/wait/sync program for M119 with an unused thread and Var 50. Heres a copy of the program im using. Fill in the define numbers for your machine at the top. Also my program sets a bit and clears a bit for starting and stopping spindle. You will have to modify program to match your machine. I think you said you stop your spindle different than mine works.
A big problem with rigid tapping is overshoot, there are two numbers in my program that you will have to tune by trial an error to get reasonable results (aim for slightly less then programmed to be safe). My program prints actual depth reached to console so you can adjust numbers easily.
Be sure to setup E-stop bit number properly as feed holding and resuming will cause Z axis to jump and likely crash into work or table and my program will trigger e-stop before this starts to happen. And be extremely careful with other rigid tapping programs that dont have this safety feature.
Hi murray,
I was just trying the version of your C code from the yahoo forum post https://groups.yahoo.com/neo/groups/...s/topics/14564. And using the Wiki...Rigid Tapping G84 Setup and Use - Dynomotion
My spindle M5 c code sets both CW and CCW bits on to stop spindle. And to reverse spindle, i have the M3 and M4 c codes to clear one bit and set the other bit.
So far my tests using the RigidTapCycleM119 c code causes the Z axis to go in the + direction, even though my gcode is Z-1. Z axis will not stop until it ether hits limit switch or i shut off spindle.(Hitting Pause button causes spindle to ramp up to full speed.) After this i have to hit estop and re run my main init code to clear out the cycle of the G84.
Should there be an axis defined and enabled in my main INIT c code for the spindle?
Attached is your code i edited to match my machine configured I/Os and such.
Thanks again,
Troy
www.tsjobshop.com, www.homecncstuff.elementfx.com
You dont need to do anything to define or enable axis in the init file, just specify what the axis number is in the tapping program.
Sounds like its slaving the Z axis but in the wrong direction. Our encoders must be counting opposite direction. You could switch A and B phases of encoder or modify program to work with you have. I wonder if speed displayed in kmotioncnc will be negative if you switch? If so then i guess i need to switch lol
I just setup the encoder info in the trajectory planner and my speed is displayed positive with M3 clockwise rotation, and negative with M4 or CCW rotation. Is yours the same or opposite?
Mine shows the same in both CW and CCW. No negative number.
I did try a quick test by changing the Z axis Counts Per Inch to -20320 in the Rigid Tap C code program and Gcode appeared to somewhat work, but still went in plus direction and stopped at about +.1415. Dont recall exact number, will need to check Kmotion console screen.
www.tsjobshop.com, www.homecncstuff.elementfx.com
If you go to axis status screen in kmotion does the encoder count up or down with m3?
IIRC, if the spindle speed is positive, then the encoder is counting up (checked by looking at the Position column, within the Axis window in KMotion).
In order to swap between negative and positive, without physically swapping encoder wiring, you have to flip the axis input gain (and possibly output gain? - It's been a while since I've done it, but I think you have to flip the output gain as well to avoid a runaway).
I just checked with my machine and as m_c says it counts up with normal M3 rotation. Make sure yours does the same.
Good idea about flipping the axis input gain, little easier to do for sure. I dont think troy is using closed loop control on his spindle so i guess the output wouldnt really be used anyway if open loop.
On kmotion axis screen CW rotation of spindle shows counts in the minus direction, but the rpm readout in kmotion CNC shows plus in both cw and ccw.
www.tsjobshop.com, www.homecncstuff.elementfx.com
I reversed the A and B phase at Kanalog and Kmotion Axis screen shows correctly. KmotionCNC rpm still shows in a positive number in both CW and CCW rotation. Did another test run of G84 and it looks good cutting air But i need to figure out how to disable the Cycle Pause as this causes spindle to ramp up to max rpm with no movement of Z axis. And causes a endless loop of Tap Cycle Failed being printed in Kmotion Console. The only way to stop it is with ESTOP.
Another possible safety issue is, if spindle is turned off during tap cycle returning to R plane and you rotate spindle by hand (or when i was testing, VERY carefully with finger tip.) to R plane, spindle will turn on again in CW direction and start tap cycle again.
Something else i need to do is either get my spindle encoder Z index connected or a proximity sensor on spindle for spindle orientate before tap cycle.
www.tsjobshop.com, www.homecncstuff.elementfx.com
Good to hear your making progress. What do you mean by pauses? Strange for spindle to ramp up? Are you using a closed loop spindle or open loop? Sorry about the endless loop. That was an oversight on my part. I stopped tweaking program once i got it to actually estop instead of rapid for table. Yes, when peck tapping spindle will restart once you reach r plane.
Keep in mind that index signal isnt totally needed. Just useful if you need to re run tap again to go deeper or something. My encoded didnt have index. I used signal from orientation proximity sensor and it worked fine.
When G84 is running and user clicks the pause button. Spindle is open loop. The test that made the spindle restart was not doing a peck tap cycle.
Another spindle run away happens if the spindle is turned off during Tap cycle and the Halt button is clicked. Also clicking the Halt button does not stop Tap cycle. Only way to clear out tap cycle is to ESTOP and re init.
www.tsjobshop.com, www.homecncstuff.elementfx.com
I dont know why your spindle is ramping up, I cant explain that. Yes, looks like you are right, the spindle will restart if the bottom has not been reached and the R plane is reached again even without peck tapping. This is part of the peck tapping code. Adding peck points make the program reverse part way down, and then at R plane it starts clockwise back into hole again if bottom was not been reached in the last attempt. This continues until bottom is reached. I wouldn't consider that an issue, really you shouldn't be stopping spindle part way through and turning it by hand.
Ideally feedhold and spindle controls should be blocked when tapping. This is the way most industrial controls operate. Once tapping is started there is no way to stop it until its complete other then doing an e-stop. Feedhold is easy to block If you use an external feedhold button (and every machine should have seperate external feedhold and cycle start buttons!). All you need to do is change your init file to check for both the Feedhold button and a persist variable to do a stopcoordinatedmotion command. And then you can set that persist variable to 1 or 0 in various other programs (toolchanger, tapping, etc) to block the feedhold button when you want too. You really should not be using the pause button in Kmotioncnc at all IMO. Its a terrible idea to use a certain button to stop the machine and then the same button to restart again. What about you get in a bad situation about to crash and hit it twice?
And the endless loop should be an easy fix. Change this:
if (ESTOPSTATE == 0 && !ReadBit(ESTOP)) Done = 1; // If e stop triggered, exit loop
if (ESTOPSTATE == 1 && ReadBit(ESTOP)) Done = 1; // If e stop triggered, exit loop
to this:
if (ESTOPSTATE == 0 && !ReadBit(ESTOP)) return 0; // If e stop triggered, exit loop
if (ESTOPSTATE == 1 && ReadBit(ESTOP)) return 0; // If e stop triggered, exit loop
Hi murray,
Totaly agree with all you said. The couple possible issues was just "feedback" in a way, mostly because iam known for finding ways to break things
It was nice to see how the Z axis stays in sink when spindle is turned off. Personally i have ran machines that work both ways and much prefer being able to pause/stop spindle during threading/tapping, especially when a tool is failing like a tap slipping in holder or that noise a tap makes right before it goes crunch. All in all its hard to cover every human error situation.
I have plans to make a control with all the industry standard physical buttons later down the road, need machine working to make it.
Will give the new code a go tonight.
Thanks again for your help with this,
Troy
www.tsjobshop.com, www.homecncstuff.elementfx.com
I tried the c code change but the spindle rpm still ramps up to full speed after clicking the pause button or pressing the F3 keyboard key. What is happening in code when a pause is issued?
www.tsjobshop.com, www.homecncstuff.elementfx.com
Hi Troy,
Do you have any action configured for Halt in KMotionCNC | Tool Setup?
Regards
Regards
TK http://dynomotion.com
Hi Tom,
Yes, a C program that sets both CW and CCW bits for spindle to shut off spindle and MDI a G80 and G40.
Last edited by Need TECH Help!; 06-28-2017 at 09:23 PM.
www.tsjobshop.com, www.homecncstuff.elementfx.com
Made a short video of just a simple rapid move and test MPG pendant.
www.tsjobshop.com, www.homecncstuff.elementfx.com