G28A0 maybe
Hi Tom,
I need to make an M code to "unwind" my 4th axis. Im running a 4 axis surface here today and ending up at like 80,000 degrees when its done. Need something to take current A machine position, divide it by 360 degrees and reset position at closest multiple of turns to zero. Same as this:
Im really busy with work at the moment and a little out of practice with c programming, wondering if you might be able to help me with this. Should be fairly simple.Thanks.
Mark
Similar Threads:
- 828d "Unwind" rotary axis
- Need help working out feed rate for "C" Axis and "Z" axis simultaneously.
- Need A Quote- 6061 T-6 2"x8" 4th axis milling needed. Have model and sample code. 10pcs minimum.
- Need Help!- 4th axis "C" rotary table on a mill and "C" axis on a lathe
- Problem- X Axis "Goes Off Pattern", "Awry", "Skewed", "Travels"
G28A0 maybe
Hi Mark,
See the Modulo360.c example:
If your system has encoders the encoder would need to be adjusted also:
Code:#include "KMotionDef.h" #define CNTS_PER_DEG 1000.0 #define AXISA 4 double modf(double, double *); // returns integer part with more than 32-bit precision double floor(double x) // truncate down toward -infinity { double y; return (modf(x, &y) < 0 ? y - 1 : y); } main() { double dest = chan[AXISA].Dest; double cnts = CNTS_PER_DEG * 360.0; double delta = (floor(dest / cnts)) * cnts; WaitNextTimeSlice(); // Avoid interrupts DisableAxis(AXISA); chan[AXISA].Position -= delta; EnableAxisDest(AXISA, dest - delta); }
Regards
TK http://dynomotion.com
Awesome, that looks easy enough. Ill give it a try on the next 4th axis job. Thanks again.