Re: Code behind the Code
Posted by
Alan Marconett KM6VV
on 2000-12-17 13:53:47 UTC
Wally,
You might try this page.
http://www.wokingham.demon.co.uk/prog/programming.htm
or:
http://www.metalworking.com/shareware.html CNC979 source.
Gcode is nothing more then a more or less agreed upon set of simple move
commands. These commands are accompanied with X, Y & Z coordinates. We
are simply instructing the computer and hardware to move linear ("G0 &
G1") to "X 2.2" a coordinate in the cartesian plane. other move
commands (circular) ("G2 & G3") allow the hardware to move in a circular
path. They use more axis (XYZ) and parameters (2.2, 1.45 etc) to
describe these more complicated moves.
The controller program "reads" these instructions line by line from the
"part program", and issues commands to the hardware to move the axis.
The first step is to "parse" the command word (like our G1 above), and
after we know that we want to move linear, we look to see which axis to
move. "X 2.2" says move the X axis to the new position 2.2. We parse
an 'X', and then the string of digits "2.2". After we have this minimal
command ("G1 X 2.2") parsed, a subroutine typically executes code to
produce pulses with the parallel port. The number of pulses required is
determined by the distance from the current location of the X axis, to
where we want it. If we were at 2.0", then the move would be .2", and
that might require 1600 pulses to be sent to the X axis stepper motor,
assuming that we need 8000 pulses per inch of travel for the X axis. We
assumed a lead screw of 20 tpi, and a 400 steps per revolution of the
stepper motor (half step), to get the 8000 steps/inch figure.
This is a SIMPLE explanation, to pursue it further, study a stepper
motor an for example, BASIC code to generate pulses for a simple stepper
motor driver.
Do you know BASIC, 'C' or Pascal? you can find examples for each if you
search the net for programs on CNC or stepper motors.
I am writing code ('C') for controller programs, as are others on the
list.
Hope this gives you a peek at what's under the hood!
Alan KM6VV
Wally6800@... wrote:
You might try this page.
http://www.wokingham.demon.co.uk/prog/programming.htm
or:
http://www.metalworking.com/shareware.html CNC979 source.
Gcode is nothing more then a more or less agreed upon set of simple move
commands. These commands are accompanied with X, Y & Z coordinates. We
are simply instructing the computer and hardware to move linear ("G0 &
G1") to "X 2.2" a coordinate in the cartesian plane. other move
commands (circular) ("G2 & G3") allow the hardware to move in a circular
path. They use more axis (XYZ) and parameters (2.2, 1.45 etc) to
describe these more complicated moves.
The controller program "reads" these instructions line by line from the
"part program", and issues commands to the hardware to move the axis.
The first step is to "parse" the command word (like our G1 above), and
after we know that we want to move linear, we look to see which axis to
move. "X 2.2" says move the X axis to the new position 2.2. We parse
an 'X', and then the string of digits "2.2". After we have this minimal
command ("G1 X 2.2") parsed, a subroutine typically executes code to
produce pulses with the parallel port. The number of pulses required is
determined by the distance from the current location of the X axis, to
where we want it. If we were at 2.0", then the move would be .2", and
that might require 1600 pulses to be sent to the X axis stepper motor,
assuming that we need 8000 pulses per inch of travel for the X axis. We
assumed a lead screw of 20 tpi, and a 400 steps per revolution of the
stepper motor (half step), to get the 8000 steps/inch figure.
This is a SIMPLE explanation, to pursue it further, study a stepper
motor an for example, BASIC code to generate pulses for a simple stepper
motor driver.
Do you know BASIC, 'C' or Pascal? you can find examples for each if you
search the net for programs on CNC or stepper motors.
I am writing code ('C') for controller programs, as are others on the
list.
Hope this gives you a peek at what's under the hood!
Alan KM6VV
Wally6800@... wrote:
>
> Since I have been a member of this group, I have tripped over "G"
> Code . I have asked people who are considered experts in CNC
> programming,"What is the code behind the code?". They haven't got a
> clue as to what is going on behind the code. They just use it because
> it works.
>
> Where can I find a source for the code behind the code? What is
> really being processed in the conputer when the command G03 is being
> executed? Any body besides me interested?
> Is there anybody in this group that knows and would share that
> knowledge?
>
> Thanks a million well in advance.
> Wally6800
Discussion Thread
Wally6800@n...
2000-12-16 15:08:11 UTC
Code behind the Code
Smoke
2000-12-16 15:18:59 UTC
Re: [CAD_CAM_EDM_DRO] Code behind the Code
Kory Hamzeh
2000-12-16 15:30:29 UTC
RE: [CAD_CAM_EDM_DRO] Code behind the Code
Jon Elson
2000-12-16 21:46:25 UTC
Re: [CAD_CAM_EDM_DRO] Code behind the Code
Jon Elson
2000-12-16 21:50:51 UTC
Re: [CAD_CAM_EDM_DRO] Code behind the Code
Alan Marconett KM6VV
2000-12-17 13:53:47 UTC
Re: Code behind the Code