Writing G and M code program via C program

Moderators: TomKerekes, dynomotion

Post Reply
ajith
Posts: 65
Joined: Sat May 21, 2022 3:57 am
Location: TamilNadu

Writing G and M code program via C program

Post by ajith » Fri Jul 15, 2022 12:10 pm

Respected Sir,
Is it possible to write C program that enters Gcode program in my screen. what im trying to say is if i press a button "MOVE" then it asks for user input such as coordination value XYZ and feed rate .when i entered the above input and press ok then the Gcode "G00 X#100 Y#101 Z#102 F100" need to be entered in my gcode screen along with my inputs

User avatar
TomKerekes
Posts: 2529
Joined: Mon Dec 04, 2017 1:49 am

Re: Writing G and M code program via C program

Post by TomKerekes » Fri Jul 15, 2022 4:49 pm

Hi,

There isn't a method for entering text into the GCode Control.

It might be much simpler to just move the axes to a position with the C Program.

But there is an MDI command to execute one line of GCode.

You can also define an Action to execute a Program and if the extension of the file is .ngc it will be executed as GCode instead of a C Program. Screen script can be used to define the Action.

GCodeAction.png
GCodeAction.png (5.76 KiB) Viewed 364 times

Then executed from KFLOP with:

Code: Select all

#include "KMotionDef.h"

#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"

void main()
{
	if (ScreenScript("Action:4;1;0;0;0;0;C:\\Temp\\GCode.ngc"))
		printf("Screen Script Failed\n");
	else
		printf("Screen Script Success\n");
}
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply