Upload
victoria-cantillo
View
238
Download
5
Embed Size (px)
DESCRIPTION
tecnologia
Citation preview
http://reprap.org/wiki/G-code/esEsta página describe las instrucciones del Código G (G-codes) de los
firmwares usados por RepRap y que hacen. El objetivo principal es la fabricación aditiva utilizando FFF /
procesos FDM. Los códigos para el cabezal de impresión están en este link NIST RS274NGC G-code
standard, Así firmwares RepRap también son bastante usable para el fresado CNC y aplicaciones
similares.
Existen muchos firmwares diferentes y sus desarrolladores tienden a implementar nuevas
funcionalidades sin discutir estrategias o mirando lo que otros hicieron antes que ellos, una gran
cantidad de instrucciones para los códigos específicos de Impresoras-3D desarrollados a lo largo de los
años.
Contents
[hide]
1 Introducción
2 Campos de G Code RepRap
3 Comentarios
4 Individual commands
o 4.1 Checking
4.1.1 N and *
o 4.2 Buffered G Commands
4.2.1 G0 & G1: Move
4.2.1.1 Notes
4.2.2 G2 & G3: Controlled Arc Move
4.2.2.1 Notes
4.2.3 G28: Move to Origin (Home)
4.2.4 G29: Detailed Z-Probe
4.2.5 G30: Single Z Probe
4.2.6 G31: Report Current Probe status
4.2.7 G32: Probe Z and calculate Z plane
o 4.3 Unbuffered G commands
4.3.1 G4: Dwell
4.3.2 G10: Tool Offset
4.3.3 G20: Set Units to Inches
4.3.4 G21: Set Units to Millimeters
4.3.5 G90: Set to Absolute Positioning
4.3.6 G91: Set to Relative Positioning
4.3.7 G92: Set Position
o 4.4 Unbuffered M and T commands
4.4.1 M0: Stop
4.4.2 M1: Sleep
4.4.3 M3: Spindle On, Clockwise (CNC specific)
4.4.4 M4: Spindle On, Counter-Clockwise (CNC specific)
4.4.5 M5: Spindle Off (CNC specific)
4.4.6 M7: Mist Coolant On (CNC specific)
4.4.7 M8: Flood Coolant On (CNC specific)
4.4.8 M9: Coolant Off (CNC specific)
4.4.9 M10: Vacuum On (CNC specific)
4.4.10 M11: Vacuum Off (CNC specific)
4.4.11 M17: Enable/Power all stepper motors
4.4.12 M18: Disable all stepper motors
4.4.13 M20: List SD card
4.4.14 M21: Initialize SD card
4.4.15 M22: Release SD card
4.4.16 M23: Select SD file
4.4.17 M24: Start/resume SD print
4.4.18 M25: Pause SD print
4.4.19 M26: Set SD position
4.4.20 M27: Report SD print status
4.4.21 M28: Begin write to SD card
4.4.22 M29: Stop writing to SD card
4.4.23 M30: Delete a file on the SD card
4.4.24 M31: Output time since last M109 or SD card start to serial
4.4.25 M32: Select file and start SD print
4.4.26 M33
4.4.27 M34
4.4.28 M36: Return file information
4.4.29 M37: Modo Simulación
4.4.30 M40: Eject
4.4.31 M41: Loop
4.4.32 M42: Stop on material exhausted / Switch I/O pin
4.4.32.1 M42 in ???
4.4.32.2 M42 in Marlin/Sprinter
4.4.32.3 M42 in Teacup
4.4.33 M43: Stand by on material exhausted
4.4.34 M80: ATX Power On
4.4.35 M81: ATX Power Off
4.4.36 M82: Set extruder to absolute mode
4.4.37 M83: Set extruder to relative mode
4.4.38 M84: Stop idle hold
4.4.39 M92: Set axis_steps_per_unit
4.4.40 M98: Call Macro/Subprogram
4.4.41 M99: Return from Macro/Subprogram
4.4.42 M98: Get axis_hysteresis_mm
4.4.43 M99: Set axis_hysteresis_mm
4.4.44 M101: Turn extruder 1 on (Forward), Undo Retraction
4.4.44.1 M101 in Teacup firmware
4.4.44.2 M101 in other firmwares
4.4.45 M102: Turn extruder 1 on (Reverse)
4.4.46 M103: Turn all extruders off, Extruder Retraction
4.4.46.1 M103 in Teacup firmware
4.4.46.2 M103 in other firmwares
4.4.47 M104: Set Extruder Temperature
4.4.47.1 M104 in Teacup Firmware
4.4.48 M105: Get Extruder Temperature
4.4.48.1 Duet-dc42 extension
4.4.49 M106: Fan On
4.4.49.1 M106 in Duet Firmware
4.4.49.2 M106 in Teacup Firmware
4.4.50 M107: Fan Off
4.4.51 M108: Set Extruder Speed
4.4.52 M109: Set Extruder Temperature and Wait
4.4.52.1 M109 in Teacup
4.4.52.2 M109 in Marlin, Sprinter (ATmega port), Duet
4.4.52.3 M109 in Sprinter (4pi port)
4.4.53 M110: Set Current Line Number
4.4.54 M111: Set Debug Level
4.4.55 M112: Emergency Stop
4.4.56 M113: Set Extruder PWM
4.4.57 M114: Get Current Position
4.4.58 M115: Get Firmware Version and Capabilities
4.4.59 M116: Wait
4.4.60 M117: Get Zero Position
4.4.60.1 M117 in Marlin, Smoothie and Duet-dc42: Display Message
4.4.61 M118: Negotiate Features
4.4.62 M119: Get Endstop Status
4.4.63 M120: Push
4.4.64 M121: Pop
4.4.65 M122: Diagnose
4.4.66 M123: Tachometer value
4.4.67 M124: Immediate motor stop
4.4.68 M126: Open Valve
4.4.69 M127: Close Valve
4.4.70 M128: Extruder Pressure PWM
4.4.71 M129: Extruder pressure off
4.4.72 M130: Set PID P value
4.4.73 M131: Set PID I value
4.4.74 M132: Set PID D value
4.4.75 M133: Set PID I limit value
4.4.76 M134: Write PID values to EEPROM
4.4.77 M135: Set PID sample interval
4.4.78 M136: Print PID settings to host
4.4.79 M140: Bed Temperature (Fast)
4.4.80 M141: Chamber Temperature (Fast)
4.4.81 M142: Holding Pressure
4.4.82 M143: Maximum hot-end temperature
4.4.83 M144: Stand By Your Bed
4.4.84 M160: Number of mixed materials
4.4.85 M190: Wait for bed temperature to reach target temp
4.4.86 M200: Set filament diameter / Get Endstop Status
4.4.87 M201: Set max printing acceleration
4.4.88 M202: Set max travel acceleration
4.4.89 M203: Set maximum feedrate
4.4.90 M204: Set default acceleration
4.4.91 M205: Advanced settings
4.4.92 M206:
4.4.92.1 M206 Marlin - Set home offset
4.4.92.2 M206 Repetier - Set eeprom value
4.4.93 M207: Calibrate z axis by detecting z max length
4.4.94 M208: Set axis max travel
4.4.95 M209: Enable automatic retract
4.4.96 M210: Set homing feedrates
4.4.97 M211: Disable/Enable software endstops
4.4.98 M220: Set speed factor override percentage
4.4.99 M221: Set extrude factor override percentage
4.4.100 M226: Gcode Initiated Pause
4.4.101 M227: Enable Automatic Reverse and Prime
4.4.102 M228: Disable Automatic Reverse and Prime
4.4.103 M229: Enable Automatic Reverse and Prime
4.4.104 M230: Disable / Enable Wait for Temperature Change
4.4.105 M240: Start conveyor belt motor / Echo off
4.4.106 M241: Stop conveyor belt motor / echo on
4.4.107 M245: Start cooler
4.4.108 M246: Stop cooler
4.4.109 M251: Measure Z steps from homing stop (Delta printers)
4.4.110 M280: Set servo position
4.4.111 M300: Play beep sound
4.4.112 M301: Set PID parameters
4.4.113 M302: Allow cold extrudes
4.4.114 M303: Run PID tuning
4.4.115 M304: Set PID parameters - Bed
4.4.116 M305: Set thermistor and ADC parameters
4.4.117 M306: set home offset calculated from toolhead position
4.4.118 M320: Activate autolevel(Repetier)
4.4.119 M321: Deactivate autolevel(Repetier)
4.4.120 M322: Reset autolevel matrix
4.4.121 M340: Control the servos
4.4.122 M355: Turn case lights on/off
4.4.123 M360: Report firmware configuration
4.4.124 SCARA calibration codes (Morgan)
4.4.125 M360: Move to Theta 0 degree position
4.4.126 M361: Move to Theta 90 degree position
4.4.127 M362: Move to Psi 0 degree position
4.4.128 M363: Move to Psi 90 degree position
4.4.129 M364: Move to Psi + Theta 90 degree position
4.4.130 M365: SCARA scaling factor
4.4.131 M370: Morgan manual bed level - clear map
4.4.132 M371: Move to next calibration position
4.4.133 M372: Record calibration value, and move to next position
4.4.134 M373: End bed level calibration mode
4.4.135 M374: Save calibration grid
4.4.136 M375: Display matrix / Load Matrix
4.4.137 M400: Wait for current moves to finish
4.4.138 M420: Set RGB Colors as PWM
4.4.139 M540: Set MAC address
4.4.140 M550: Set Name
4.4.141 M551: Set Password
4.4.142 M552: Set IP address
4.4.143 M553: Set Netmask
4.4.144 M554: Set Gateway
4.4.145 M555: Set compatibility
4.4.146 M556: Axis compensation
4.4.147 M557: Set Z probe point
4.4.148 M558: Set Z probe type
4.4.149 M559: Upload configuration file
4.4.150 M560: Upload web page file
4.4.151 M561: Set Identity Transform
4.4.152 M562: Reset temperature fault
4.4.153 M563: Define a tool
4.4.154 M564: Limit axes
4.4.155 M565: Set Z probe offset
4.4.156 M566: Set allowable instantaneous speed change
4.4.157 M567: Set tool mix ratios
4.4.158 M568: Turn off/on tool mix ratios
4.4.159 M569: Set axis direction values
4.4.160 M570: Set heater timeout
4.4.161 M571: Set output on extrude
4.4.162 M572: Set or report extruder elasticity compensation
4.4.163 M573: Report heater PWM
4.4.164 M574: Set endstop configuration
4.4.165 M575: Set serial comms parameters
4.4.166 M665: Set delta configuration
4.4.167 M666: Set delta endstop adjustment
4.4.168 M906: Set motor currents
4.4.169 M909: Set microstepping
4.4.170 M998: Request resend of line
4.4.171 M999: Restart after being stopped by error
4.4.172 G: List all G-codes
4.4.173 M: List all M-codes
4.4.174 T: Select Tool
5 Proposed EEPROM configuration codes
o 5.1 M500: store parameters in EEPROM
o 5.2 M501: read parameters from EEPROM
o 5.3 M502: revert to the default "factory settings."
o 5.4 M503: Print settings
6 Replies from the RepRap machine to the host computer
7 Proposal for sending multiple lines of G-code
o 7.1 Problem to solve
8 Alternatives to G-code
Introducción
Una típica parte de Codigo G que fue enviado a una máquina RepRap podría tener este aspecto:
N3 T0*57
N4 G92 E0*67
N5 G28*22
N6 G1 F1500.0*82
N7 G1 X2.0 Y2.0 F3000.0*85
N8 G1 X3.0 Y3.0*33
El significado de todos estos símbolos y números es explicado en esta pagina.
Para hacer mas facil saber que Codigo G especifico es implementado en un firmware especifico, hay
pequeños cuadros que se adjuntan a las descripciones de los comandos, como éste:
Soportado FiveD Teacup Sprinter Marlin Repetier
Si Automático Si Si Experimental
Esto significa
Si Totalmente soportado.
Experimental Existe un soporte. A menudo se requiere de revisar un código de fuentes distintas de la
predeterminada o voltear algunos interruptores de configuración.
Automático El firmware se encarga de esta función de forma automática, así que no hay necesidad de
enviar el comando, se obtiene la característica de tener en cuenta. Un ejemplo es la fuente de
alimentación encendido / apagado (M80/M81) en Teacup firmware
No El firmware no soporta esta característica.
Solo por tecnicismo, al final de cada línea se caracteriza por una <nl> y opcionalmente un <cr>. Por lo
tanto, los finales de línea de Unix funcionan tan bien como los de Windows.
Campos de G Code RepRap
En esta sección se explican los campos que van precedidos por una letra. Los números en los campos
son representados pornnn. Los números pueden ser enteros (integers) (128) o
números racionales (12.42), dependiendo del contexto. Por ejemplo, la coordenada X puede ser entera
(X175) o racional (X17.62), pero seleccionar el extrusor número 2.76 no tendría sentido.
Letra Significado
Gnnn Comando GCode estándar, como moverse hasta un punto
Mnnn Comando definido por RepRap, como encender un ventilador
Tnnn Seleccionar la herramienta nnn. En RepRap, las herramientas son extrusores
Snnn Parámetro de comando, como la tensión enviada a un motor
Pnnn Parámetro de comando, como el tiempo en milisegundos
Xnnn Una coordenada X, normalmente para moverse a ella. Puede ser un número entero o racional.
Ynnn Una coordenada Y, normalmente para moverse a ella. Puede ser un número entero o racional.
Znnn Una coordenada Z, normalmente para moverse a ella. Puede ser un número entero o racional.
Innn Parámetro - Actualmente no utilizado
Jnnn Parámetro - Actualmente no utilizado
Fnnn Feedrate en mm por minuto. (Velocidad de movimiento del cabezal de impresión)
Rnnn Parámetro - usado para temperaturas
Qnnn Parámetro - Actualmente no utilizado
Ennn
Longitud a extruir en mm. Ex exactamente como X, Y y Z, pero para la cantidad de filamento a extruir. Es común que los nuevos sistemas basados en pasos lo interpreten... Mejor: Skeinforge 40 y siguientes interpretan esto como la longitud absuluta de filamento insertado, no como la longitud de la extrusión que sale.
Nnnn Número de línea. Utilizado para pedir la repetición de la transmisión en caso de errores de comunicación.
*nnn Checksum. Usado para comprobar errores de comunicación.
Comentarios
Los comentarios en Gcode comienzan con punto y coma y terminan al final de la línea:
N3 T0*57 ; Esto es un comentarioN4 G92 E0*67; Esto también lo esN5 G28*22
Los comentarios y espacios en blanco serán ignorados por tu impresora RepRap. Es mejor quitarlos en
el ordenador anfitrión antes de enviar el Gcode a tu impresora, ya que así se ahorra ancho de banda.
Individual commands
CheckingN and *
Example: N123 [...G Code in here...] *71
These are the line number and the checksum. The RepRap firmware checks the checksum against a
locally-computed value and, if they differ, requests a repeat transmission of the line of the given number.
You can leave both of these out - RepRap will still work, but it won't do checking. You have to have both
or neither though.
The checksum "cs" for a GCode string "cmd" (including its line number) is computed by exor-ing the
bytes in the string up to and not including the * character as follows:
int cs = 0;for(i = 0; cmd[i] != '*' && cmd[i] != NULL; i++) cs = cs ^ cmd[i];cs &= 0xff; // Defensive programming...
and the value is appended as a decimal integer to the command after the * character.
The RepRap firmware expects line numbers to increase by 1 each line, and if that doesn't happen it is
flagged as an error. But you can reset the count using M110 (see below).
Buffered G Commands
The RepRap firmware stores these commands in a ring buffer internally for execution. This means that
there is no (appreciable) delay while a command is acknowledged and the next transmitted. In turn, this
means that sequences of line segments can be plotted without a dwell between one and the next. As
soon as one of these buffered commands is received it is acknowledged and stored locally. If the local
buffer is full, then the acknowledgment is delayed until space for storage in the buffer is available. This is
how flow control is achieved.
G0 & G1: Move
Support
FiveD Teacup Sprinter Marlin Repetier Smoothi
e RepRapFirmware
yes yes yes yes yes yes yes
Usage
G0 Xnnn Ynnn Znnn Ennn Fnnn Snnn
G1 Xnnn Ynnn Znnn Ennn Fnnn Snnn
Variables
Not all variables need to be used, but at least one has to be used
Xnnn The position to move to on the X axis
Ynnn The position to move to on the Y axis
Znnn The position to move to on the Z axis
Ennn The amount to extrude between the starting point and ending point
Fnnn The feedrate per minute of the move between the starting point and ending point (if
supplied)
Snnn Flag to check if an endstop was hit (S1 to check, S0 to ignore, S2 see note, default is S0)1
Examples
G0 X12 (move to 12mm on the X axis)
G0 F1500 (Set the feedrate to 1500mm/minute)
G1 X90.6 Y13.8 E22.4 (Move to 90.6mm on the X axis and 13.8mm on the Y axis while
extruding 22.4mm of material)
The RepRap firmware spec treats G0 and G1 as
the same command, since it's just as efficient as
not doing so.2
Most RepRap firmwares do subtle things with
feedrates.
1. G1 F15002. G1 X50 Y25.3 E22.4
In the above example, we set the feedrate to
1500mm/minute on line 1, then move to 50mm on
the X axis and 25.3mm on the Y axis while
extruding 22.4mm of filament between the two
points.
1. G1 F15002. G1 X50 Y25.3 E22.4 F3000
However, in the above example, we set a feedrate
of 1500 mm/minute on line 1, then do the move
described above accelerating to a feedrate of
3000 mm/minute as it does so. The extrusion will
accelerate along with the X and Y movement, so
everything stays synchronized.
The RepRap spec treats the feedrate as simply
another variable (like X, Y, Z, and E) to be linearly
interpolated. This gives complete control over the
acceleration and deceleration of the printer head
in such a way that ensures that everything moves
smoothly together, and the right volume of
material is extruded at all points.3
To reverse the extruder by a given amount (for
example to reduce its internal pressure while it
does an in-air movement so that it doesn't dribble)
simply use G0 or G1 to send an E value that is
less than the currently extruded length.
Notes
1Some firmwares allow for the RepRap to enable
or disable the "sensing" of endstops during a
move. Please check with whatever firmware you
are using to see if they support the S variable in
this way, as damage may occur if you assume
incorrectly. In Duet-dc42 firmware, using the S1 or
S2 parameter on a delta printer causes the XYZ
parameters to refer to the individual tower motor
positions instead of the head position, and to
enable endstop detection as well if the parameter
is S1.
2In the RS274NGC Spec, G0 is Rapid Move,
which was used to move between the current
point in space and the new point as quickly and
efficiently as possible, and G1 is Controlled Move,
which was used to move between the current
point in space and the new point as precise as
possible.
3Some firmwares may not support setting the
feedrate inline with a move.
4zpl fork of the Duet firmware implements an
additional 'R1' parameter to tell the machine to go
back to the coordinates a print was originally
paused at.
Some older machines, CNC or otherwise, used to
move faster if they did not move in a straight line.
This is also true for some non-Cartesian printers,
like delta or polar printers, which move easier and
faster in a curve.
G2 & G3: Controlled Arc Move
Support
FiveD
Teacup
Sprinter
Marlin
Repetier
Smoothie
RepRapFirmware
no no no yes1 yes yes no
Usage
G2 Xnnn Ynnn Innn Jnnn Ennn (Clockwise Arc)
G3 Xnnn Ynnn Innn Jnnn Ennn (Counter-Clockwise Arc)Variables
Xnnn The position to move to on the X axis
Ynnn The position to move to on the Y axis
Innn The point in X space from the current X position to maintain a constant distance from
Jnnn The point in Y space from the current Y position to maintain a constant distance from
Ennn The amount to extrude between the starting point and ending point
Examples
G2 X90.6 Y13.8 I5 J10 E22.4 (Move in a Clockwise arc from the current point to point
(X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of
material between starting and stopping)
G3 X90.6 Y13.8 I5 J10 E22.4 (Move in a Counter-Clockwise arc from the current point to point
(X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of
material between starting and stopping)