Re: Issue with M6 execution
Hi David,
The Interpreter should wait until Motion is finished before calling the M6 C Program. So I'm not sure why you are having the issue. What Version are you running?
I can't access your cnczone Attachments for some reason.
I believe you are getting the "Generic GCode Errors" because you have syntax errors in your C Programs. There is no CheckBit function (unless you have created one). Maybe you wished to use ReadBit ?
I'd try the blank program with just the printf statement. You didn't include that for us to check it for syntax. You might try compiling the C programs within KMotion.exe to check for errors before you try to run GCode.
Regards
Re: Issue with M6 execution
Hi David,
Thanks for the Alternate URLs as the first Attachments are invalid for some reason.
In the screen shot that shows the problem the Y axis DRO is displayed Yellow indicating the Y axis is disabled.
I think we might have an issue with our code where is the Interpreter is waiting for motion to finish in order to execute a C Program and a disable error occurs then the C Program is incorrectly executed instead of properly aborting. Is there a message on the KMotion Console indicating the reason the Y axis is disabled? Or I could be wrong and the M6 program executing too early might be the cause of the Y axis Disable.
Let's get the dummy M6 code that just prints a message working first. Can you post the program that just prints the line to the KMotion Console? The program can not just contain the printf statement. It still needs to include the KMotionDef.h header and the main() body.
Regards
Re: Issue with M6 execution
Hi David,
Sorry I'm having a hard time reproducing the problem.
Could you send me the GCode you are using? Or still better could you test if the example spiral.ngc with M6 inserted at line 50 also has the problem for you.
Please post all your settings: Trajectory Planner Screen and your C Initialization program. Anything else "special" about your configuration that you can think of?
Have you Flashed any programs into KFLOP? Flashing "New Version" will eliminate this possibility.
Please try the latest Test Version:
http://www.dynomotion.com/Software/KMotion433j.exe
Regards
Re: Issue with M6 execution
Hi David,
I think the issue is that pointers to doubles must have 64-bit alignments (must be a multiple of 8 bytes). The persist data structure contains 32 bit entities so it does not necessarily have 64-bit alignment. We made a mistake in our earlier examples where we assumed that pairs of UserData variables could be accessed with a double pointer. That worked until one version happened to have an odd offset and broke many older examples. I think your code happened to work with the version with the odd offset that broke our examples. The later Versions now force even alignment with a linker Pragma. So if you change your variables to even Variable numbers it may work. But we also have added example functions in KflopToKMotionCNCFunctions.c that we prefer you to use :
Code:
double GetUserDataDouble(int i)
{
double d;
((int*)(&d))[0] = persist.UserData[i*2];
((int*)(&d))[1] = persist.UserData[i*2+1];
return d;
}
void SetUserDataDouble(int i, double v)
{
double d=v;
persist.UserData[i*2] = ((int*)(&d))[0];
persist.UserData[i*2+1] = ((int*)(&d))[1] ;
}
These will work regardless of alignment.
HTH
Regards