Page 1 of 1
C program to run G codes
Posted: Wed Oct 24, 2018 8:55 am
by baburdy
Hi!
Is it possible to FLASH a G code program into KFLOP?
If it is not so, How can I run KmotionCNC program using C program?
I want to flash a Gcode program into the device. It is easier for me to run my application. Kindly suggest me a way to do that.
I think it is possible to run a G code program using C program.
Kindly guide me or send me a sample C program to "Run a G code program using a C program".
With regards,
Mani
Re: C program to run G codes
Posted: Wed Oct 24, 2018 3:10 pm
by TomKerekes
Hi Mani,
Does your system have a PC? If so it would be easier and better to run the GCode from a PC Application.
Without a PC, KFLOP only has ~1 MByte of Flash Data storage.
Re: C program to run G codes
Posted: Thu Oct 25, 2018 4:05 am
by baburdy
Hi Tom,
We are using Kflop + Kstep device. Now we are running the application using KmotionCNC software without flashing the data. It is easy for us to run the application using the G-codes. But G codes cannot be flashed into the device directly. i.e. We are running the application by connecting the device with PC.
So, kindly suggest us a way to flash G codes.
If it is not possible, send us any sample C program to run the G codes.
With regards,
Mani.
Re: C program to run G codes
Posted: Thu Oct 25, 2018 3:24 pm
by TomKerekes
Hi Mani,
I still don't understand.
If you have a PC in your system there is no reason to Flash GCode. Just save it on the PC and run it using our PC Libraries.
You might see the
SimpleGCode C++ example or the
KMotion_dotNet Console RunInterpreterExample() C# example.
See here for information on PC samples.
Re: C program to run G codes
Posted: Fri Oct 26, 2018 4:17 am
by baburdy
Hi Tom,
My question is, Now we are using the device with the help of PC without flashing the G codes we are running our application,
but we want to run the application without the help of PC.
For that I need to flash my G-codes into the device.
Kindly suggest me an idea to flash G codes.
Regards,
Mani.
Re: C program to run G codes
Posted: Fri Oct 26, 2018 4:56 pm
by TomKerekes
Hi Mani,
Ok so you don't want to use a PC.
KFLOP itself doesn't have a GCode Interpreter or Coordinated Motion Trajectory Planner. So Flashing GCode to KFLOP wouldn't work.
Maybe you could describe more clearly exactly what you need to do. Is it simple and small amount of GCode? Does it ever change?
Some users have created stand-alone systems that run fixed, simple, motion patterns using the technique described below. One of the first Users to do this created a stand-alone machine to write "Happy Birthday" on a cake with icing.
#1 - Connect a PC
#2 - Run a small GCode Job. This downloads "coordinated motion" to KFLOP's Coordinated Motion Buffer. This is basically a big list of equations.
#3 - Write the Coordinated Motion Buffer data to USER_FLASH memory
#4 - Disconnect the PC
#5 - Cycle Power
#6 - Copy the data from Flash back into the Coordinated Motion Buffer
#7 - Execute the motion
Here is a
Yahoo Thread where a User created code to save multiple motion jobs to Flash memory and was able to selectively run them.
Does this seem like something you could do?
Re: C program to run G codes
Posted: Mon Oct 29, 2018 4:53 am
by baburdy
Hi Tom,
Regarding your previous reply, Can you elaborate the steps #3 , #5, #6.
Can you provide any sample Coordinated Motion Buffer program which could be flashed to USER_FLASH memory.
Regards,
Mani.
Re: C program to run G codes
Posted: Mon Oct 29, 2018 3:53 pm
by TomKerekes
Hi Mani,
Did you read through the Thread I linked to?
Cycle Power means to turn power off and back on.
The Motion Program would be something you create (any simple GCode Program)
Re: C program to run G codes
Posted: Tue Oct 30, 2018 7:31 am
by baburdy
Hi Tom,
I followed your instruction, I ran my G code program which i had attached with this message.
After running the G code program, i want to flash that same G code program into the device.
So i used the below code
#define FLASH ((volatile char *)0x90000000) // beginning of FLASH - first 1MByte is for System Use
#define FLASH_USER ((volatile char *)0x90100000) // 2nd MegByte is for User use
I does'nt work.
My Question is, G code is already in running status, How can i run the COORDINATED MOTION BUFFER PROGRAM?
What should that COORDINATED MOTION BUFFER program have?
Because i am running the COORDINATED MOTION operation already with the G code itself?. Kindly explain..(i.e. Step #3)
Kindly send me a sample COORDINATED PROGRAM for my reference. It is easy for my to understand and execute.
I have read the Thread which you have sent. By i cant able to download or view the attachment with that thread.
Kindly send me any sample program to FLASH G codes.
Regards,
Mani
Re: C program to run G codes
Posted: Wed Oct 31, 2018 4:46 am
by TomKerekes
Hi Mani,
So i used the below code
#define FLASH ((volatile char *)0x90000000) // beginning of FLASH - first 1MByte is for System Use
#define FLASH_USER ((volatile char *)0x90100000) // 2nd MegByte is for User use
I does'nt work.
Those are just defines for the compiler. It doesn't generate any code. You will need to study C Programming to be able to do this.
I plotted your GCode:
- ManiGCode.png (8.3 KiB) Viewed 3590 times
How much Coordinated Motion Buffer that is used will depend on the Trajectory Planner Smoothing and corner rounding. I ran the code with these typical settings:
- ManiTP.png (4.87 KiB) Viewed 3590 times
The GCode took 42 seconds to execute and generated 4068 Coordinated Motion Segments and used 878KBytes of memory. Just under the 1MByte of Flash space available.
Attached is a
MonitorParametricIndex.c program that will display on the Console how much Coordinated Motion Data has been downloaded as the GCode is running. When the GCode finishes it showed:
ParametricIndex=4068 (878688 bytes) 83.80 % TimeDownloaded=42.441sec
The attached example program called
FlashCoordMotionWriteData.c will write the data to Flash.
The attached example program called
FlashCoordMotionReadData.c will read the data from Flash and execute it.
Let me know how much of this you can understand.