G code HAL detect

More
11 Apr 2013 21:01 #32566 by diegoroman17
Hi everybody,

I need detect in hal the actual Gcode that is running, if it is G0 or not. Is possible do it?

Please Log in or Create an account to join the conversation.

More
11 Apr 2013 22:20 #32573 by ArcEye
Replied by ArcEye on topic G code HAL detect
Hi

It is quite difficult to ascertain exactly which line of the G Code is being executed

There is no way to do it in HAL AFAIK

In C something like
if (programStartLineLast < 0 || emcStatus->task.readLine < programStartLineLast) 
    {
    // controller is skipping lines
    programActiveLine = emcStatus->task.readLine;
    }
else 
    {
    // controller is not skipping lines
    if (emcStatus->task.currentLine > 0) 
        {
        if (emcStatus->task.motionLine > 0 && emcStatus->task.motionLine < emcStatus->task.currentLine) 
            programActiveLine = emcStatus->task.motionLine;
        else 
            programActiveLine = emcStatus->task.currentLine;
        }
    else 
        programActiveLine = 0;
    }

but it is often difficult still to get accurate updating of the current line

You can fetch the active GCodes, but you are dependent upon the speed of updating etc as to whether they are accurate
(a short G00 line surrounded by G01 lines might show fleetingly after that line is executed, if the move is very short)
QString getActiveGCodes()
{                                                                                                                    
int code;
char string[80];
QString active_g_codes;

    active_g_codes.clear();
    string[0] = 0;
         ..
    for (int t = 1; t < ACTIVE_G_CODES; t++).
        {
        code = emcStatus->task.activeGCodes[t];
        if (code == -1)
            continue;
                                                 ....
        if (code % 10).
            sprintf(string, "G%.1f ", (double) code / 10.0);
        else
            sprintf(string, "G%d ", code / 10);
        active_g_codes += string;
        }
 
    return active_g_codes;
}

To get it more accurately, you may need to hook into the interpreter, depends exactly what you are trying to do

regards

Please Log in or Create an account to join the conversation.

More
11 Apr 2013 22:47 #32574 by diegoroman17
Replied by diegoroman17 on topic G code HAL detect
mmm This is quite difficult. It occurred to me a better solution. I will use a digital output before G0 in G code tell me if it runs or not G0.

Please Log in or Create an account to join the conversation.

More
11 Apr 2013 23:12 #32576 by ArcEye
Replied by ArcEye on topic G code HAL detect
If you are only going to be executing your own code, that is a lot easier :woohoo:

Please Log in or Create an account to join the conversation.

More
11 Apr 2013 23:14 #32577 by diegoroman17
Replied by diegoroman17 on topic G code HAL detect
jjj yeah. I have develop a sofware CAM into Corel Draw for generate my own G Code. Thanks for help me ArcEye

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum