Jdi na navigaci předmětu

GCode

GCode in general

  • G-Code = GCode = gcode = GCODE
  • Language for CNC machines control
  • Textual commands are transferred trough the serial line
  • Detailed description can be found on the RepRap wiki

Example:

G92 E0
G28
G1 F1500.0*82
G1 X2.0 Y2.0 F3000.0*85
G1 X3.0 Y3.0*33

Commands categories

  • Gnn - Standard GCode command (hence the name)
    • movement to a location - G0,G1
    • setting position - G92
    • units settings - G20,G21
  • Mnn - RepRap-defined command
    • stop, pause the printer
    • accesing the SD card
    • turn on/off the fans
    • etc.
  • Tnn - Select tool
    • Tool selection - e.g. extruder selection

Buffered/Unbuffered commands

Buffred commands are acked (i.e. non-blocking), unbuffered waits for finish and report “done” (i.e. blocking).

Buffered

Right after receiving ack is sent and command is saved to the buffer (capacity of such buffer differs from device to device). There is a natural time gap between what the control software reports as done and what is actually happening.

Examples: * G0 - Rapid move * G1 - Controlled move * G28 - Move to Origin * G29-G32 - Z-Probe Example

Unbuffered

Response is sent after the command was executed.

Mostly M commands, but that’s not a rule.

Examples:

M106 ;turn on the fan
M99 ;printer reset

Example

G1 X104.322 Y80.678 F1365.000 E0.28619 ; perimeter
G1 X104.322 Y99.322 E0.28618 ; perimeter
G1 X85.678 Y99.322 E0.28618 ; perimeter
G1 X85.678 Y80.746 E0.28514 ; perimeter
G1 X85.226 Y80.226 F7800.000 ; move to first perimeter point
G1 X104.774 Y80.226 F955.500 E0.30006 ; perimeter
G1 X104.774 Y99.774 E0.30006 ; perimeter
G1 X85.226 Y99.774 E0.30006 ; perimeter
G1 X85.226 Y80.294 E0.29902 ; perimeter
G1 X85.618 Y80.452 F7800.000 ; move inwards before travel
screen shot 2013 10 16 at 18.52.41

How to view GCode

You can preview GCode in the Pronterface app. Use Load file and load the .gcode file. When loaded (could take some time), double-click the middle canvas area to examine layers.