Page 1 of 1
M6 TXXXX QYY
Posted: Fri May 27, 2022 11:10 am
by cemoa9
Hello Tom,
For cycle time improvement I would like to change my M6 code to have not only the tool changed but also the A axis moved (rotary table), does M6 support a second parameter?
Cordially,
Francois
Re: M6 TXXXX QYY
Posted: Fri May 27, 2022 4:19 pm
by TomKerekes
Hi Francois,
No it doesn't. You could use a dummy M Code to first pass some parameters. ie
M100 Pxxx Qyyy Rzzz
M6 Txxx
Re: M6 TXXXX QYY
Posted: Tue May 31, 2022 12:45 pm
by cemoa9
Hello Tom,
Thanks it works, but I kinda got an issue while reading DROs, sometimes GetDROs(...) is not getting updated and the value of the previous movement is shown in the console. I use the latest version of KMotionCNC.
here is the code :
double DROx, DROy, DROz, DROa, DROb, DROc, OffsetZ;
GetDROs(&DROx, &DROy, &DROz, &DROa, &DROb, &DROc);
printf("DROa = %f\n", DROa);
It happened twice, DRO was 0 on KMotionCNC, but appeared as 90 in the console, causing a wrong rotary table movement (no crash

)
Cordially,
Francois
Re: M6 TXXXX QYY
Posted: Tue May 31, 2022 2:11 pm
by cemoa9
Hello Tom,
I just tried using MDI(s) command, there also I have a problem, the command will only work randomly :
WaitNextTimeSlice();
char s[80];
float Angle = *(float *)&persist.UserData[TMP];
Angle = 10; // just for trial to have a fix value
sprintf(s,"G0 A%f", Angle);
MDI(s);
I may need to run it 20 times to have it moving.
I am using a very slow computer (cheap win10 tablet), may that be the issue?
Edit : I added a delay of 0.01s in the init program in the forever loop, it seems to have solved the MDI issue, but it does not feel safe...
Cordially,
Francois
Re: M6 TXXXX QYY
Posted: Tue May 31, 2022 5:17 pm
by TomKerekes
The communication to KMotionCNC is not Thread safe. That is if two Threads send a command at the same time then commands can be dropped or results mixed up.
If your forever loop is issuing commands then one solution is to have the other Thread tell the forever loop to issue the command rather than doing the command itself.
HTH