G-code/kr
English • العربية • български • català • čeština • Deutsch • Ελληνικά • español • فارسی • français • hrvatski • magyar • italiano • română • 日本語 • 한국어 • lietuvių • Nederlands • norsk • polski • português • русский • Türkçe • українська • 中文(中国大陆) • 中文(台灣) • עברית • azərbaycanca • |
이 페이지는 RepRap 펌웨어들이 사용하는 G-code 의 종류와 그것들이 어떻게 동작하는지 설명하기 위한 것이다. 주요한 적용 대상은 FFF 공정을 사용하는 적층 제조이다. 프린트 헤드의 움직임을 위한 코드들은 NIST RS274NGC G-code standard를 따른다. 따라서 RepRap 펌웨어들은 CNC 밀링이나 비슷한 방식에도 사용할 수 있다.
프린터를 위한 GCode를 준비하는 데에는 몇 가지 다른 방식들이 있다. 한 가지는 Slic3r, Skeinforge 나 Cura와 같은 슬라이서를 사용하는 것이다. 이 프로그램들은 CAD 모델을 층들로 썰어내고, 각 층마다 필요한 GCode를 생산해낸다. 슬라이서는 3차원 모델로부터 출력물로 가기 위한 가장 쉬운 방법이다. 하지만 사용자는 그러한 사용 중에 일부 flexibility(?)을 희생해야한다. GCode 생성을 위한 또 다른 선택지는 mecode와 같은 더 낮은 레벨의 라이브러리를 사용하는 것이다. mecode 같은 라이브러리는 도구 경로를 정확히 컨트롤 할 수 있도록 해주고, 또한 그러므로써 슬라이싱 기법이 적합하지 않은 복잡한 출력을 해야 할 때 유용하다. 마지막 방법은 직접 GCode를 바로 쓰는 것이다. 이것은 프린터를 calibrating하는 동안 몇개의 선을 그릴 필요가 있을때라면 가장 좋은 방법일 것이다.
많은 다른 형태의 펌웨어들이 존재하고 그 개발자들은 이전에 다른 사람들이 했던 것을 찾아보거나, 구현방법에 대한 논의 없이 새로운 기능들을 구현하려는 경향이 있기 때문에, 3D 프린터를 위한 특정 코드들은 많은 세부 종류들이 여러 해를 거듭하여 개발되었다.(개발자나 펌웨어의 종류에 따라 특정한 동일 코드가 서로 다른 기능을 가질 수 있다는 얘기인 것 같습니다.)
Contents
- 1 소개
- 2 RepRap G Code 항
- 3 주석
- 4 각 명령어들에 대한 설명
- 4.1 검사
- 4.2 버퍼링 되는 G 명령들
- 4.3 Unbuffered G commands
- 4.4 버퍼링되지 않는 M과 T 명령
- 4.4.1 M0: 정지
- 4.4.2 M1: 휴면
- 4.4.3 M3: 스핀들 켜기, 시계방향 (CNC 전용)
- 4.4.4 M4: 스핀들 켜기, 반시계방향 (CNC 전용)
- 4.4.5 M5: 스핀들 끄기 (CNC 전용)
- 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: SD 카드에서 파일을 삭제
- 4.4.24 M40: Eject
- 4.4.25 M41: Loop
- 4.4.26 M42: Stop on material exhausted / Switch I/O pin
- 4.4.27 M43: Stand by on material exhausted
- 4.4.28 M80: ATX Power On
- 4.4.29 M81: ATX Power Off
- 4.4.30 M82: set extruder to absolute mode
- 4.4.31 M83: set extruder to relative mode
- 4.4.32 M84: Stop idle hold
- 4.4.33 M92: Set axis_steps_per_unit
- 4.4.34 M98: Get axis_hysteresis_mm
- 4.4.35 M99: Set axis_hysteresis_mm
- 4.4.36 M101 Turn extruder 1 on Forward / Undo Extruder Retraction
- 4.4.37 M102 Turn extruder 1 on Reverse
- 4.4.38 M103 Turn all extruders off / Extruder Retraction
- 4.4.39 M104: 압출기 온도 설정(Set Extruder Temperature)
- 4.4.40 M105: Get Extruder Temperature
- 4.4.41 M106: 팬 ON
- 4.4.42 M107: Fan Off
- 4.4.43 M108: Set Extruder Speed
- 4.4.44 M109: 압출기 온도 설정 후 대기(Set Extruder Temperature and Wait)
- 4.4.45 M110: Set Current Line Number
- 4.4.46 M111: Set Debug Level
- 4.4.47 M112: 긴급 정지
- 4.4.48 M113: Set Extruder PWM
- 4.4.49 M114: Get Current Position
- 4.4.50 M115: Get Firmware Version and Capabilities
- 4.4.51 M116: 대기
- 4.4.52 M117: Get Zero Position
- 4.4.53 M117 in Marlin: 메시지 표시
- 4.4.54 M118: Negotiate Features
- 4.4.55 M119: Get Endstop Status
- 4.4.56 M120: Push
- 4.4.57 M121: Pop
- 4.4.58 M122: Diagnose
- 4.4.59 M126: Open Valve
- 4.4.60 M127: Close Valve
- 4.4.61 M128: Extruder Pressure PWM
- 4.4.62 M129: Extruder pressure off
- 4.4.63 M130: Set PID P value
- 4.4.64 M131: Set PID I value
- 4.4.65 M132: Set PID D value
- 4.4.66 M133: Set PID I limit value
- 4.4.67 M134: Write PID values to EEPROM
- 4.4.68 M135: Set PID sample interval
- 4.4.69 M136: Print PID settings to host
- 4.4.70 M140: 베드 온도 설정(Bed Temperature) (Fast)
- 4.4.71 M141: Chamber Temperature (Fast)
- 4.4.72 M142: Holding Pressure
- 4.4.73 M143: Maximum hot-end temperature
- 4.4.74 M160: Number of mixed materials
- 4.4.75 M190: 베드 온도를 지정한 온도가 되기를 기다림(Wait for bed temperature to reach target temp)
- 4.4.76 M200 - Set filament diameter / Get Endstop Status
- 4.4.77 M201 - Set max printing acceleration
- 4.4.78 M202 - Set max travel acceleration
- 4.4.79 M203 - Set maximum feedrate
- 4.4.80 M204 - Set default acceleration
- 4.4.81 M205 - advanced settings
- 4.4.82 M206: set home offset
- 4.4.83 M207: calibrate z axis by detecting z max length
- 4.4.84 M208: set axis max travel
- 4.4.85 M209: enable automatic retract
- 4.4.86 M210: Set homing feedrates
- 4.4.87 M220:set speed factor override percentage
- 4.4.88 M221: set extrude factor override percentage
- 4.4.89 M226: Gcode Initiated Pause
- 4.4.90 M227: Enable Automatic Reverse and Prime
- 4.4.91 M228: Disable Automatic Reverse and Prime
- 4.4.92 M229: Enable Automatic Reverse and Prime
- 4.4.93 M230: Disable / Enable Wait for Temperature Change
- 4.4.94 M240: Start conveyor belt motor / Echo off
- 4.4.95 M241: Stop conveyor belt motor / echo on
- 4.4.96 M245: Start cooler
- 4.4.97 M246: Stop cooler
- 4.4.98 M300: '삐' 소리 재생
- 4.4.99 M301: Set PID parameters - Hot End
- 4.4.100 M302: Allow cold extrudes
- 4.4.101 M303: Run PID tuning
- 4.4.102 M304: Set PID parameters - Bed
- 4.4.103 M400: Wait for current moves to finish
- 4.4.104 M420: Set RGB Colors as PWM
- 4.4.105 M550: Set Name
- 4.4.106 M551: Set Password
- 4.4.107 M552: Set IP address
- 4.4.108 M553: Set Netmask
- 4.4.109 M554: Set Gateway
- 4.4.110 M555: Set compatibility
- 4.4.111 M556: Axis compensation
- 4.4.112 M557: Set Z probe point
- 4.4.113 M558: Set Z probe type
- 4.4.114 M559: Upload configuration file
- 4.4.115 M560: Upload web page file
- 4.4.116 M561: Set Identity Transform
- 4.4.117 M906: Set motor currents
- 4.4.118 M998: Request resend of line
- 4.4.119 M999: Restart after being stopped by error
- 4.4.120 T: Select Tool
- 5 Proposed SCARA calibration codes (Morgan)
- 5.1 M360 : Move to Theta 0 degree position
- 5.2 M361 : Move to Theta 90 degree position
- 5.3 M362 : Move to Psi 0 degree position
- 5.4 M363 : Move to Psi 90 degree position
- 5.5 M364 : Move to Psi + Theta 90 degree position
- 5.6 M365 : SCARA scaling factor
- 5.7 M370 : Morgan manual bed level - clear map
- 5.8 M371 : Move to next calibration position
- 5.9 M372 : Record calibration value, and move to next position
- 5.10 M373 : End bed level calibration mode
- 5.11 M375 : Display matrix
- 6 Proposed EEPROM configuration codes
- 7 Replies from the RepRap machine to the host computer
- 8 여러 줄의 G-코드를 전송하기 위한 제안
- 9 Alternatives to G-code
소개
RepRap 기기로 전송되기 위한 전형적인 GCode의 조각은 다음과 같다:
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
위의(그리고 그 이상의) 심볼과 숫자에 대한 의미가 아래에 설명되어 있다. 어떠한 펌웨어에 구현된 특정 GCode를 찾기 위한 명령어를 기술한 다음과 같은 작은 테이블이 있다:
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes | automatic | yes | yes | experimental |
이 의미는 :
- yes
- 완전 지원
- experimental
- 몇몇은 지원. 이 경우는 종종 기본적이거나 중요한 설정이 바뀌지 않았는지 소스 코드 브랜치를 확인할 필요가 있다.
- automatic
- 펌웨어가 이 항목(feature)을 자동으로 핸들링하기 때문에 명령어를 전송할 필요가 없다; 당신은 이 특징을 신경쓸 필요가 없다. 예를 들어 Teacup 펌웨어에서 전원공급기 on/off(M80/M81) 같은 것이 있다.
- no
- 펌웨어가 이 항목을 지원하지 않는다.
기술적으로 보기 위해, 매 줄의 끝은 <nl>가 첨부되고 선택적으로 <cr>도 첨부된다. 따라서 Unix 라인 종료 기능은 Windows에서처럼 잘 이루어진다.
RepRap G Code 항
이 절은 글자가 앞에 나오는 항에 대해 설명한다. 각 항에 숫자는 nnn으로 표현한다. 숫자는 문맥에 따라 정수로 쓰이거나 소수점을 포함할 수 있다.예를 들어 X좌표는 정수 (X175) 또는 소수(X17.62)를 사용할 수 있지만 압출기 번호 2.76은 아무 의미가 없습니다.
글자 | 의미 |
---|---|
Gnnn | 어떤 점으로 이동하라는 것과 같은 표준 GCode 명령. |
Mnnn | RepRap에 의해 정의된 명령. 예를 들면 쿨링 팬 회전. |
Tnnn | 도구 nnn 선택. RepRap에서 도구는 압출기. |
Snnn | 파라미터 명령. 예를 들어 모터로 보내는 전압. |
Pnnn | 파라미터 명령. 밀리초 동안의 time |
Xnnn | 이동을 위해 사용하는 X 좌표. |
Ynnn | 이동을 위해 사용하는 Y 좌표. |
Znnn | 이동을 위해 사용하는 Z 좌표. |
Innn | 파라미터. 현재는 사용하지 않음. |
Jnnn | 파라미터. 현재는 사용하지 않음. |
Fnnn | 1분당 Feedrate. (프린트 헤드의 움직임 스피드) |
Rnnn | 파라미터 - 온도에 사용 |
Qnnn | Parameter - not currently used |
Ennn | 압출형의 길이 mm. 이것은 정확히 X, Y, Z 와 같지만 필라멘트를 압출하는 길이이다. |
Nnnn | 선 번호. 통신 오류시 재전송 요청을 위해 사용. |
*nnn | 체크섬 : 통신 오류를 체크하는데 사용. |
주석
다음과 같은 G-Code 주석들은:
N3 T0*57 ;This is a comment N4 G92 E0*67 ; So is this N5 G28*22
RepRap이 빈 줄과 마찬가지로 무시할 것이다. 그러나, 이런 줄들은 전송하기 전에 제거하는 것이 더 좋다. 대역폭을 절약할 수 있다.(쓸데 없는 데이터 전송을 방지)
각 명령어들에 대한 설명
검사
N and *
Example: N123 [...G Code in here...] *71
줄번호와 체크섬이다. RepRap 펌웨어는 자기가 계산한 값과 체크섬을 비교한다. 만약 다르다면, 해당 라인의 재전송을 요청한다.
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).
버퍼링 되는 G 명령들
RepRap 펌웨어는 이 명령들을 실행을 위해 내부의 링 버퍼에 저장한다. 이것은 명령이 승인되고 다음 명령이 전송되는 동안 (주목할만한) 딜레이가 없다는 것을 의미한다. 이것은 연속된 선분들이 멈칫거리지 않고 차례대로 그려질 수 있다는 것을 의미한다. 이런 버퍼링 되는 명령들은 (펌웨어에서) 받는 즉시 승인이 되고 저장이 된다. 만약 버퍼가 가득차면, 버퍼의 공간이 확보될 때까지 승인이 지연된다. 이것이 흐름제어를 하는 방법이다.
G0: 빠른 이동(rapid move)
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
??? | yes | yes | yes | yes |
예제: G0 X12
X = 12mm 인 지점으로 빠르게 이동하는 경우.
사실, RepRap 펌웨어는 빠른 이동(rapid move)에 통제된 이동(controlled move)에 사용된 것과 완전히 똑같은 코드를 사용한다.(G1 명령 참고) 따라서, RepRap 머신의 경우 이 명령은 별다른 효과가 없다.
(축들을 직선으로 구동하지 않는 몇몇 구형 장비들에서는 더 빠르게 이동하기 위해 사용된다. 그런 장비들의 경우에는 G0 명령은 목적지로 가능한 빠르게 도달하기 위한 어떤 움직임도 허용한다.)
G1: 제어된 이동(controlled move)
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes | yes | yes | yes | yes |
예제: G1 X90.6 Y13.8 E22.4
현재 위치(X,Y)에서 (90.6, 13.8)의 위치로 직선 이동하고, 현재 압출된 길이에서 22.4mm 길이까지 압출이 되며 이동한다.
RepRap은 Feedrate을 이용하여 세세한 것들도 할 수 있다.
G1 F1500 G1 X90.6 Y13.8 E22.4
이것은 feedrate을 1500mm/minute 으로 설정하고, 이 속도로 위에서 설명한 이동을 할 것이다.
G1 F1500 G1 X90.6 Y13.8 E22.4 F3000
그러나 이것은 feedrate 을 1500mm/min 으로 설정하고, feedrate 을 3000mm/min 으로 가속하면서 위에서 설명한 이동을 할 것이다. 압출 역시 모든 것이 동기화 되어 X,Y 축의 이동에 맞추어 가속이 될 것이다.
RepRap 은 그래서 feedrate 을 선형적으로 보간하기 위해 또 다른 변수로 다룬다. (X, Y, Z, E 같은). 이것은 가감속 하는 동안 모든 움직임과 모든 지점에서의 올바른 양(부피)이 압출되는 것을 보장하는 어느정도 완벽한 제어를 하게 한다.
Note: 모든 펌웨어가 이것을 구현한 것은 아니다. 예를 들어, 현재 Marlin 은 이동의 시작점부터 새 feedrate 값을 사용할 것이다. 그리고 그 값을 변경하지 않는다.
첫번째 예제는 정속 이동을 어떻게 하는지 보여줬다. 두번째는 어떻게 가속과 감속을 하는지 보여준다.
G1 F1500 G1 X90.6 Y13.8 E22.4 F3000 G1 X80 Y20 E36 F1500
이것은 이전에 설명한 것처럼 가속을 하며 첫번째 이동을 한다. 그리고 3000mm/min 에서 1500mm/min으로 감속을 하며 이동한다.
압출기를 주어진 양만큼 되돌리기 위해서는(예를 들어 내부 공중을 이동하면서 재료를 흘리지 않기 위해 노즐 내 압력을 낮추기 위한 예제로) 간단히 G1 을 사용하고 E 값을 현재 압출된 길이보다 작은 값으로 설정한다.
G28: 원점으로 이동
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes | yes | yes | yes | yes |
예제: G28
이 명령은 RepRap 기계를 X, Y, Z 축의 엔드스탑이 있는 곳으로 이동시킨다. "호밍(homing)"이라고 알려진 과정이다. 이것은 가속을 해서 홈위치로 빠르게 이동을 한다. 하지만 홈 위치에 도달했을 때 각 방향으로 1mm 정도 천천히 후진을 한 뒤, 다시 엔드스탑의 위치로 천천히 움직인다. 이것은 더 정확한 홈 위치를 잡을 수 있게 한다.
만약 명령에 좌표를 추가하면, 해당 축의 원점을 찾을 것이다. 그래서
G28 X0 Y72.3
이런 명령은 X와 Y 축의 원점으로 이동하지만, Z 축은 수행하지 않는다. 좌표값은 무시된다.
G29-G32: Bed probing
G29 Detailed Z-Probe
probes the bed at 3 points.
G30 Single Z Probe
In its simplest form probes bed at current XY location.
Some implementations allow more general behaviour: if a Pn field is specified the probed X, Y, and Z values are saved as point n on the bed for calculating the offset plane. Generally n is 0, 1, or 2. If X, or Y, or Z values are specified (e.g. G30 P1 X20 Y50 Z0.3) then those values are used instead of the machine's current coordinates. A silly Z value (less than -9999.0) causes the machine to probe at the current point to get Z, rather than using the given value. If an S field is specfied (e.g. G30 P1 Z0.3 S) the bed plane is computed for compensation and stored. The combination of these options allows for the machine to be moved to points using G1 commands, and then probe the bed, or for the user to position the nozzle interactively and use those coordinates. The user can also record those values and place them in a setup GCode file for automatic execution.
G31 Report Current Probe status
When used on its own this reports whether the Z probe is triggered, or gives the Z probe value in some units if the probe generates height values. If combined with a Z and P field (example: G31 P312 Z0.7) this will set the Z height to 0.7mm when the Z-probe value reaches 312 when a G28 Z0 (zero Z axis) command is sent. The machine will then move a further -0.7mm in Z to place itself at Z = 0. This allows non-contact measuring probes to approach but not touch the bed, and for the gap left to be allowed for. If the probe is a touch probe and generates a simple 0/1 off/on signal, then G31 Z0.7 will tell the RepRap machine that it is at a height of 0.7mm when the probe is triggered.
G32 Probe Z and calculate Z plane
probes the bed at 3 pre-defined points (see M557) and updates transformation matrix for bed leveling compensation.
Unbuffered G commands
The following commands are not buffered. When one is received it is stored, but it is not acknowledged to the host until the buffer is exhausted and then the command has been executed. Thus the host will pause at one of these commands until it has been done. Short pauses between these commands and any that might follow them do not affect the performance of the machine.
Teacup Firmware buffers G20, G21, G90 and G91.
G4: Dwell
Example: G4 P200
In this case sit still doing nothing for 200 milliseconds. During delays the state of the machine (for example the temperatures of its extruders) will still be preserved and controlled.
G10: Head Offset
Example: G10 P3 X17.8 Y-19.3 Z0.0 R140 S205
This sets the offset for extrude head 3 (from the P3) to the X and Y values specified. You can put a non-zero Z value in as well, but this is usually a bad idea unless the heads are loaded and unloaded by some sort of head changer. When all the heads are in the machine at once they should all be set to the same Z height.
Remember that any parameter that you don't specify will automatically be set to the last value for that parameter. That usually means that you want explicitly to set Z0.0.
The R value is the standby temperature in oC that will be used for the tool, and the S value is its operating temperature. If you don't want the head to be at a different temperature when not in use, set both values the same. See the T code (select tool) below.
The NIST G-code standard mentions an additional L parameter, which is ignored.
This command is subject to discussion.
G20: Set Units to Inches
Example: G20
Units from now on are in inches.
G21: Set Units to Millimeters
Example: G21
Units from now on are in millimeters. (This is the RepRap default.)
G90: Set to Absolute Positioning
Example: G90
All coordinates from now on are absolute relative to the origin of the machine. (This is the RepRap default.)
G91: Set to Relative Positioning
Example: G91
All coordinates from now on are relative to the last position.
G92: Set Position
Example: G92 X10 E90
Allows programming of absolute zero point, by reseting the current position to the values specified. This would set the machine's X coordinate to 10, and the extrude coordinate to 90. No physical motion will occur.
A G92 without coordinates will reset all axes to zero.
버퍼링되지 않는 M과 T 명령
M0: 정지
예제 : M0
RepRap 머신이 버퍼에 남아있는 움직임을 모두 끝내고 종료한다.. 모든 모터와 히터는 꺼진다. 이것은 마스터 마이크로컨트롤러의 리셋 버튼에 의해 재시작될 수 있다. M1과 M112 참조
M1: 휴면
예제: M1
RepRap 머신이 버퍼에 남아있는 움직임을 모두 끝내고 종료한다. 모든 모터와 히터는 꺼진다. G코드와 M 코드 전송은 가능하다. 전송된 첫번째 코드가 깨우고 재시작할 것이다. M0와 M112 참조 The RepRap machine finishes any moves left in its buffer, then shuts down. All motors and heaters are turned off. It can still be sent G and M codes, the first of which will wake it up again. See also M0, M112.
M3: 스핀들 켜기, 시계방향 (CNC 전용)
예제: M3 S4000
스핀들이 4000RPM으로 켜져서 시계방향으로 돌아간다.
M4: 스핀들 켜기, 반시계방향 (CNC 전용)
예제: M4 S4000
스핀들이 4000RPM으로 켜져서 반시계방향으로 돌아간다.
M5: 스핀들 끄기 (CNC 전용)
예제: M5
The spindle is turned off.
M7: Mist Coolant On (CNC specific)
예제: M7
Mist coolant is turned on (if available)
M8: Flood Coolant On (CNC specific)
예제: M8
Flood coolant is turned on (if available)
M9: Coolant Off (CNC specific)
예제: M9
All coolant systems are turned off.
M10: Vacuum On (CNC specific)
예제: M10
Dust collection vacuum system turned on.
M11: Vacuum Off (CNC specific)
예제: M11
Dust collection vacuum system turned off.
M17: Enable/Power all stepper motors
예제: M17
M18: Disable all stepper motors
예제: M18
Disables stepper motors and allows axis to move 'freely.'
M20: List SD card
예제: M20
All files in the root folder of the SD card are listed to the serial port. This results in a line like:
ok Files: {SQUARE.G,SQCOM.G,}
The trailing comma is optional. Note that file names are returned in upper case, but - when sent to the M23 command (below) they must be in lower case. This seems to be a function of the SD software. Go figure...
M21: Initialize SD card
예제: M21
The SD card is initialized. If an SD card is loaded when the machine is switched on, this will happen by default. SD card must be initialized for the other SD functions to work.
M22: Release SD card
예제: M22
SD card is released and can be physically removed.
M23: Select SD file
예제: M23 filename.gco
The file specified as filename.gco (8.3 naming convention is supported) is selected ready for printing.
M24: Start/resume SD print
예제: M24
The machine prints from the file selected with the M23 command.
M25: Pause SD print
예제: M25
The machine pause printing at the current position within the file selected with the M23 command.
M26: Set SD position
예제: M26
Set SD position in bytes (M26 S12345).
M27: Report SD print status
예제: M27
Report SD print status.
M28: Begin write to SD card
예제: M28 filename.gco
File specified by filename.gco is created (or overwritten if it exists) on the SD card and all subsequent commands sent to the machine are written to that file.
M29: Stop writing to SD card
예제: M29 filename.gco
File opened by M28 command is closed, and all subsequent commands sent to the machine are executed as normal.
M30: SD 카드에서 파일을 삭제
예제: M30 filename.gco
filename.gco가 삭제된다.
M40: Eject
If your RepRap machine can eject the parts it has built off the bed, this command executes the eject cycle. This usually involves cooling the bed and then performing a sequence of movements that remove the printed parts from it. The X, Y and Z position of the machine at the end of this cycle are undefined (though they can be found out using the M114 command, q.v.).
See also M240 and M241 below.
M41: Loop
예제: M41
If the RepRap machine was building a file from its own memory such as a local SD card (as opposed to a file being transmitted to it from a host computer) this goes back to the beginning of the file and runs it again. So, for example, if your RepRap is capable of ejecting parts from its build bed then you can set it printing in a loop and it will run and run. Use with caution - the only things that will stop it are:
- When you press the reset button,
- When the build material runs out (if your RepRap is set up to detect this), and
- When there's an error (such as a heater failure).
M42: Stop on material exhausted / Switch I/O pin
M42 in ???
예제: M42
If your RepRap can detect when its material runs out, this decides the behaviour when that happens. The X and Y axes are zeroed (but not Z), and then the machine shuts all motors and heaters off. You have to press reset to reactivate the machine. In other words, it parks itself and then executes an M0 command (q.v.).
M42 in Marlin/Sprinter
예제: M42 P7 S255
M42 범용 I/O 핀을 스위칭한다.
M42 in Teacup
Not needed. General purpose devices are handled like a heater, see M104.
M43: Stand by on material exhausted
예제: M43
If your RepRap can detect when its material runs out, this decides the behaviour when that happens. The X and Y axes are zeroed (but not Z), and then the machine shuts all motors and heaters off except the heated bed, the temperature of which is maintained. The machine will still respond to G and M code commands in this state.
M80: ATX Power On
예제: M80
Turns on the ATX power supply from standby mode to fully operational mode. No-op on electronics without standby mode.
Note: some firmwares, like Teacup, handle power on/off automatically, so this is redundant there. Also, see RAMPS wiring for ATX on/off
M81: ATX Power Off
예제: M81
Turns off the ATX power supply. Counterpart to M80.
M82: set extruder to absolute mode
예제: M82
makes the extruder interpret extrusion as absolute positions.
This is the default in repetier.
M83: set extruder to relative mode
예제: M83
makes the extruder interpret extrusion values as relative positions.
M84: Stop idle hold
예제: M84
Stop the idle hold on all axis and extruder. In some cases the idle hold causes annoying noises, which can be stopped by disabling the hold. Be aware that by disabling idle hold during printing, you will get quality issues. This is recommended only in between or after printjobs.
M92: Set axis_steps_per_unit
예제: M92 X<newsteps> Sprinter and Marlin
Allows programming of steps per unit of axis till the electronics are reset for the specified axis. Very useful for calibration.
M98: Get axis_hysteresis_mm
예제: M98
Report the current hysteresis values in mm for all of the axis.
Proposed for Marlin
M99: Set axis_hysteresis_mm
예제: M99 X<mm> Y<mm> Z<mm> E<mm>
Allows programming of axis hysteresis. Mechanical pulleys, gears and threads can have hysteresis when they change direction. That is, a certain number of steps occur before movement occurs. You can measure how many mm are lost to hysteresis and set their values with this command. Every time an axis changes direction, these extra mm will be added to compensate for the hysteresis.
Proposed for Marlin
M101 Turn extruder 1 on Forward / Undo Extruder Retraction
M101 in Teacup firmware
If a DC extruder is present, turn that on. Else, undo filament retraction, which means, make the extruder ready for extrusion. Complement to M103.
M101 in other firmwares
Deprecated. Regarding filament retraction, see M227, M228, M229.
M102 Turn extruder 1 on Reverse
Deprecated.
M103 Turn all extruders off / Extruder Retraction
M103 in Teacup firmware
If a DC extruder is present, turn that off. Else, retract the filament in the hope to prevent nozzle drooling. Complement to M101.
M103 in other firmwares
Deprecated. Regarding extruder retraction, see M227, M228, M229.
M104: 압출기 온도 설정(Set Extruder Temperature)
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes | yes | yes | yes | yes |
예제: M104 S190
현재 선택되어있는 압출기의 온도를 190oC 로 설정하고 호스트로 제어권을 즉시 넘긴다.(즉, 압출기의 온도가 설정 온도에 도달하기 전에) M109 항목 참조할 것.
이 코드는 앞으로 사라지게 될 것이다. 온도는 G10 명령과 T 파라미터를 사용하여 설정해야 하기 때문이다(q.v.).
Deprecation is subject to discussion. --Traumflug 11:33, 19 July 2012 (UTC)
M104 in Teacup Firmware
Teacup 펌웨어에서는, M104 온도 센서를 사용하는 모든 장치들을 제어하는데 사용될 수 있다. 이것은 P 파라미터를 지원하며, config.h 에 지정된 센서 목록을 사용하고 인덱스는 0부터 시작한다. 온도 센서가 없는 장치들은 M106 항목을 볼 것.
예제: M104 P1 S100
두번째 온도 센서가 부착된 장치의 온도를 100 °C 로 설정한다.
M105: Get Extruder Temperature
예제: M105
Request the temperature of the current extruder and the build base in degrees Celsius. The temperatures are returned to the host computer. For example, the line sent to the host in response to this command looks like: ok T:201 B:117
Expansion/generalization of M105 to be considered as noted in Pronterface I/O Monitor
M106: 팬 ON
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes | yes | yes |
예제 : M106 S127
쿨링팬을 최대 속력의 절반으로 켠다.
필수 파라미터 'S'는 PWM 값(0-255)를 정의한다. M106 S0은 팬을 끈다. 몇몇의 구현에서 PWM은 실수 값으로 구현되기도 한다 : M106 S0.7.
Teacup 펌웨어에서의 M106
위의 내용에 추가하여 Teacup 펌웨어는 M106을 일반적인 장치를 제어하는데 사용한다. 이것은 추가적인 heaters/devices 폴더의 config.h파일에 나열된 zero-based 인덱스인 P 파라미터를 지원한다.
예제: M106 P2 S255
장치 #3를 최대 속력/전력으로 켜라.
Note: 만일 히터에 장착된 온도센서가 M106과 M104에 의해 동시에 켜질 경우 온도 제어는 M106에 의해 빨리 override 할 것이다.
M107: Fan Off
Deprecated. Use M106 S0 instead.
M108: Set Extruder Speed
Sets speed of extruder motor. (Deprecated in current firmware, see M113)
M109: 압출기 온도 설정 후 대기(Set Extruder Temperature and Wait)
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
??? | not needed | see text | yes | ??? |
M109 in Teacup
필요없음. Marlin의 동작을 흉내내려면, M116 에 이어 M104 을 연달아 사용할 것.
M109 in Marlin, Sprinter (ATmega port)
압출기 히터의 온도를 설정하고 해당 온도에 도달하기를 기다림. 단위는 섭씨
예제: M109 S185
M109 in Sprinter (4pi port)
파라미터: S (optional), 목표 온도 설정. 만약 정해주지 않으면, M104 에서 설정한 온도가 되기를 기다림. 파라미터: R (optional), 목표 온도 범위의 최대값을 설정.
예제: M109 S185 R240 //압출기의 온도를 185도로 설정하고 압출기의 온도가 185~240도가 되기를 기다림.
만약 압출기가 여러개라면, T 나 P 파라미터를 사용하여 압출기를 선택할 것.
이 기능을 사용하기 위한 또 다른 방법은 G10 을 사용하는 것이다.
M110: Set Current Line Number
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
??? | not needed | ??? | ??? | ??? |
예제: M110 N123
Set the current line number to 123. Thus the expected next line after this command will be 124.
M111: Set Debug Level
예제: M111 S6
Set the level of debugging information transmitted back to the host to level 6. The level is the OR of three bits:
#define DEBUG_ECHO (1<<0) #define DEBUG_INFO (1<<1) #define DEBUG_ERRORS (1<<2)
Thus 6 means send information and errors, but don't echo commands. (This is the RepRap default.)
예제: M253
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
Debug |
M112: 긴급 정지
예제: M112
진행상의 어떤 움직임이 갑자기 종료될 경우 RepRap은 셧다운된다. 모든 모터와 히터가 꺼진다. 이것은 마스터 마이크로컨트롤러의 리셋버튼에 의해 재시작될 수 있다. M0와 M1 참조
M113: Set Extruder PWM
예제: M113
Set the PWM for the currently-selected extruder. On its own this command sets RepRap to use the on-board potentiometer on the extruder controller board to set the PWM for the currently-selected extruder's stepper power. With an S field:
M113 S0.7
it causes the PWM to be set to the S value (70% in this instance). M113 S0 turns the extruder off, until an M113 command other than M113 S0 is sent.
M114: Get Current Position
예제: M114
This causes the RepRap machine to report its current X, Y, Z and E coordinates to the host.
For example, the machine returns a string such as:
ok C: X:0.00 Y:0.00 Z:0.00 E:0.00
In Marlin first 3 numbers is the position for the planner. The other positions are the positions from the stepper function. This helps for debugging a previous stepper function bug.
X:0.00 Y:0.00 RZ:0.00 LZ:0.00 Count X:0.00 Y:0.00 RZ:41.02 LZ:41.02
M115: Get Firmware Version and Capabilities
예제: M115
Request the Firmware Version and Capabilities of the current microcontroller The details are returned to the host computer as key:value pairs separated by spaces and terminated with a linefeed.
sample data from firmware:
ok PROTOCOL_VERSION:0.1 FIRMWARE_NAME:FiveD FIRMWARE_URL:http%3A//reprap.org MACHINE_TYPE:Mendel EXTRUDER_COUNT:1
This M115 code is inconsistently implemented, and should not be relied upon to exist, or output correctly in all cases. An initial implementation was committed to svn for the FiveD Reprap firmware on 11 Oct 2010. Work to more formally define protocol versions is currently (October 2010) being discussed. See M115_Keywords for one draft set of keywords and their meanings.
M116: 대기
예제: M116
모든 온도와 다른 천천히 변하는 변수들이 설정된 값에 도달할 때까지 대기한다. M109 참조
M117: Get Zero Position
예제: M117
This causes the RepRap machine to report the X, Y, Z and E coordinates in steps not mm to the host that it found when it last hit the zero stops for those axes. That is to say, when you zero X, the x coordinate of the machine when it hits the X endstop is recorded. This value should be 0, of course. But if the machine has drifted (for example by dropping steps) then it won't be. This command allows you to measure and to diagnose such problems. (E is included for completeness. It doesn't normally have an endstop.)
M117 in Marlin: 메시지 표시
예제: M117 Hello World
이것은 메시지를 상태를 표시하기 위해 컨트롤러에 연결된 LCD에 메시지를보낸다. 위의 명령은 Hello World를 표시하도록 할 것이다.
M118: Negotiate Features
예제: M118 P42
This M-code is for future proofing. NO firmware or hostware supports this at the moment. It is used in conjunction with M115's FEATURES keyword.
See Protocol_Feature_Negotiation for more info.
M119: Get Endstop Status
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes | yes | yes |
예제: M119
Returns the current state of the configured X, Y, Z endstops. Takes into account any 'inverted endstop' settings, so one can confirm that the machine is interpreting the endstops correctly.
M120: Push
Push the state of the RepRap machine onto a stack. Exactly what variables get pushed depends on the implementation (as does the depth of the stack - a typical depth might be 5). A sensible minimum, however, might be
- Current feedrate, and
- Whether moves (and separately extrusion) are relative or absolute
M121: Pop
Recover the last state pushed onto the stack.
M122: Diagnose
Sending an M122 causes the RepRap to transmit diagnostic information, for eaxmple via a USB serial link.
M126: Open Valve
예제: M126 P500
Open the extruder's valve (if it has one) and wait 500 milliseconds for it to do so.
M127: Close Valve
예제: M127 P400
Close the extruder's valve (if it has one) and wait 400 milliseconds for it to do so.
M128: Extruder Pressure PWM
예제: M128 S255
PWM value to control internal extruder pressure. S255 is full pressure.
M129: Extruder pressure off
예제: M129 P100
In addition to setting Extruder pressure to 0, you can turn the pressure off entirely. P400 will wait 100ms to do so.
M130: Set PID P value
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes |
예제: M130 P 0 S 8.0 # Sets heater 0 P factor to 8.0
M131: Set PID I value
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes |
예제: M130 P 1 S 0.5 # Sets heater 1 I factor to 0.5
M132: Set PID D value
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes |
예제: M130 P 0 S 24 # Sets heater 0 D factor to 24.0
M133: Set PID I limit value
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes |
예제: M130 P 1 S 264 # Sets heater 0 I limit value to 264
M134: Write PID values to EEPROM
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes |
예제: M134
M135: Set PID sample interval
예제: M135 S300
Set the PID to measure temperatures and calculate the power to send to the heaters every 300ms.
M136: Print PID settings to host
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
Debug |
예제: M136 P1 # print heater 0 PID parameters to host
M140: 베드 온도 설정(Bed Temperature) (Fast)
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes | yes | yes | yes |
예제: M140 S55
이 코드는 베드의 온도를 55oC 로 설정하고 제어권을 즉시 호스트로 넘긴다.(즉, 베드의 온도가 설정한 온도에 도달하기 전에)
M141: Chamber Temperature (Fast)
예제: M141 S30
Set the temperature of the chamber to 30oC and return control to the host immediately (i.e. before that temperature has been reached by the chamber).
M142: Holding Pressure
예제: M142 S1
Set the holding pressure of the bed to 1 bar.
The holding pressure is in bar. For hardware which only has on/off holding, when the holding pressure is zero, turn off holding, when the holding pressure is greater than zero, turn on holding.
M143: Maximum hot-end temperature
예제: M143 S275
Set the maximum temperature of the hot-end to 275C
When temperature of the hot-end exceeds this value, take countermeasures, for instance an emergency stop. This is to prevent hot-end damage.
M160: Number of mixed materials
예제: M160 S4
Set the number of materials, N, that the current extruder can handle to the number specified. The default is 1.
When N >= 2, then the E field that controls extrusion requires N+1 values separated by spaces after it like this:
M160 S4 G1 X90.6 Y13.8 E22.4 0.1 0.1 0.1 0.7 G1 X70.6 E42.4 0.0 0.0 0.0 1.0 G1 E42.4 1.0 0.0 0.0 0.0
The second line moves straight to the point (90.6, 13.8) extruding 22.4mm of filament. The mix ratio at the end of the move is 0.1:0.1:0.1:0.7.
The third line moves back 20mm in X extruding 20mm of filament. The mix varies linearly from 0.1:0.1:0.1:0.7 to 0:0:0:1 as the move is made.
The fourth line has no physical effect, but sets the mix proportions for the start of the next move to 1:0:0:0.
M190: 베드 온도를 지정한 온도가 되기를 기다림(Wait for bed temperature to reach target temp)
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
obsolete, see M116 | yes | yes |
예제: M190 S60
이 코드는 베드 온도가 60도가 되기를 기다리며, 매 초마다 핫엔드와 베드의 온도를 출력한다.
M200 - Set filament diameter / Get Endstop Status
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
yes |
M200 sets the filament diameter.
Question: what does a firmware do with filament diameter? Has this an effect on how much an E command moves the extruder motor? --Traumflug 11:34, 14 October 2012 (UTC)
M201 - Set max printing acceleration
in units/s^2 for print moves (M201 X1000 Y1000)
M202 - Set max travel acceleration
in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
M203 - Set maximum feedrate
that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
Note: this should be in units/minute, just like the F code.
M204 - Set default acceleration
S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
M205 - advanced settings
minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk
M206: set home offset
예제: M206 X10.0 Y10.0 Z-0.4
The values specified are added to the endstop position when the axes are referenced. The same can be achieved with a G92 right after homing (G28, G161).
With Marlin firmware, this value can be saved to EEPROM using the M500 command.
A similar command is G10, aligning these two is subject to discussion.
M207: calibrate z axis by detecting z max length
예제: M207
After placing the tip of the nozzle in the position you expect to be considered Z=0, issue this command to calibrate the Z axis. It will perform a z axis homing routine and calculate the distance traveled in this process. The result is stored in EEPROM as z_max_length. For using this calibration method the machine must be using a Z MAX endstop.
This procedure is usually more reliable than mechanical adjustments of a Z MIN endstop.
M208: set axis max travel
예제: M208 X250 Y210 Z180
The values specified set the software limits for axis travel in the positive direction.
With Marlin firmware, this value can be saved to EEPROM using the M500 command.
M209: enable automatic retract
예제: M209 S1
This boolean value S 1=true or 0=false enables automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
M210: Set homing feedrates
예제: M210 X1000 Y1500
Set the feedrates used for homing to the values specified in mm per minute.
M220:set speed factor override percentage
예제: M220 S80
S<factor in percent>- set speed factor override percentage
M221: set extrude factor override percentage
예제: M221 S70
S<factor in percent>- set extrude factor override percentage
M226: Gcode Initiated Pause
Example: M226
Initiates a pause in the same way as if the pause button is pressed. That is, program execution is stopped and the printer waits for user interaction. This matches the behaviour of M1 in the NIST RS274NGC G-code standard and M0 in Marlin firmware.
M227: Enable Automatic Reverse and Prime
예제: M227 P1600 S1600
P and S are steps.
"Reverse and Prime" means, the extruder filament is retracted some distance when not in use and pushed forward the same amount before going into use again. This shall help to prevent drooling of the extruder nozzle. Teacup firmware implements this with M101/M103.
M228: Disable Automatic Reverse and Prime
Example: M228
See also M227.
M229: Enable Automatic Reverse and Prime
Example: M229 P1.0 S1.0
P and S are extruder screw rotations. See also M227.
M230: Disable / Enable Wait for Temperature Change
Example: M230 S1
S1 Disable wait for temperature change S0 Enable wait for temperature change
M240: Start conveyor belt motor / Echo off
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
Debug: Echo off |
Example: M240
The conveyor belt allows to start mass production of a part with a reprap.
Echoing may be controlled in some firmwares with M111
M241: Stop conveyor belt motor / echo on
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
Debug: Echo on |
Example: M241
Echoing may be controlled in some firmwares with M111
M245: Start cooler
Example: M245
used to cool parts/heated-bed down after printing for easy remove of the parts after print
M246: Stop cooler
Example: M246
M300: '삐' 소리 재생
사용법: M300 S<frequency Hz> P<duration ms>
예제: M300 S300 P1000
'삐' 소리를 재생한다. 프린팅 종료와 같은 중요한 이벤트를 알려주기 위해 사용한다.
여러 줄의 명령을 사용하여 간단한 멜로디 재생도 가능하다. 예제는 여기를 참조 R2C2 electronics.
S는 음의 주파수(Hz 단위). [음계별 주파수 예제]
P는 음의 길이(ms 단위).
M301: Set PID parameters - Hot End
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
PID |
Example: M301 P1 I2 D3 C5
Sets Proportional, Integral and Derivative values for hot end, the value C refers to an extrusion rate.
Alternate implementation
Example: M301 W125
M302: Allow cold extrudes
This tells the printer to allow movement of the extruder motor, when the hotend is not at printing temperature
Example: M302
M303: Run PID tuning
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
PID | PID |
Hotend Usage: M303 S<temperature> C<cycles> Bed Usage: M303 E-1 C<cycles> S<temperature> Example: M303 C8 S175
Generate Proportional, Integral and Derivative values for the hotend or bed (E-1). Send the appropriate code and wait for the output to update the firmware.
M304: Set PID parameters - Bed
Support | FiveD | Teacup | Sprinter | Marlin | Repetier |
---|---|---|---|---|---|
PID |
Example: M304 P1 I2 D3
Sets Proportional, Integral and Derivative values for bed
M400: Wait for current moves to finish
Finishes all current moves and and thus clears the buffer. That's identical to G4 P0
.
Example: M400
M420: Set RGB Colors as PWM
Usage: M420 R<Red PWM (0-255)> E<Green PWM (0-255)> B<Blue PWM (0-255)>
Example: M420 R255 E255 B255
Set the color of your RGB LEDs that are connected to PWM-enabled pins. Note, the Green color is controlled by the E value instead of the G value due to the G code being a primary code that cannot be overridden.
M550: Set Name
Example: M550 PGodzilla
Sets the name of the RepRap to (in this case) Godzilla. The name can be any string of printable characters except ';', which still means start comment.
M551: Set Password
Example: M551 Pmy-very-secret-word
On machines that need a password to activate them, set that password. The code 'P' is not part of the password. Note that as this is sent in clear it does not (nor is it intended to) offer a very high level of security. But on machines that are (say) on a network, it prevents idle messing about by the unauthorised. The password can contain any printable charcters except ';', which still means start comment.
M552: Set IP address
Example: M552 P192.168.1.14
Sets the IP address of the RepRap machine to (in this case) 192.168.1.14. If no P field is specified, this echos the existing IP address.
M553: Set Netmask
Example: M553 P255.255.255.0
Sets the IP address of the RepRap machine to (in this case) 255.255.255.0. If no P field is specified, this echos the existing Netmask.
M554: Set Gateway
Example: M554 P192.168.1.1
Sets the Gateway of the RepRap machine to (in this case) 192.168.1.1. If no P field is specified, this echos the existing Gateway.
M555: Set compatibility
Example: M555 P1
For firmware that can do it, sets the firmware to a mode where its input and (especially) output behaves exactly like other established firmware. The value of the P argument is:
P value | Firmware |
0 | Native (i.e. whatever the firmware actually is) |
1 | RepRap_Firmware |
2 | Marlin |
3 | Teacup |
4 | Sprinter |
5 | Repetier |
M556: Axis compensation
Example: M556 S100 X0.7 Y-0.2 Z0.6
Though with care and adjustment a RepRap can be set up with its axes at right-angles to each other within the accuracy of the machine, who wants to bother with care and adjustment when the problem can be solved by software? This tells software the tangents of the angles between the axes of the machine obtained by printing then measuring a test part. The S parameter (100 here) is the length of a triangle along each axis in mm. The X, Y and Z figures are the number of millimeters of the short side of the triangle that represents how out of true a pair of axes is. The X figure is the error between X and Y, the Y figure is the error between Y and Z, and the Z figure is the error between X and Z. Positive values indicate that the angle between the axis pair is obtuse, negative acute.
M557: Set Z probe point
Example: M557 P1 X30 Y40.5
Set the points at which the bed will be probed to compensate for its plane being slightly out of horizontal. The P value is the index of the point (indices start at 0) and the X and Y values are the position to move extruder 0 to to probe the bed. An implementation should allow a minimum of three points (P0, P1 and P2). This just records the point coordinates; it does not actually do the probing. See G32.
M558: Set Z probe type
Example: M558 P0
A Z probe may be a switch (the default) an IR proximity sensor, or some other device. This selects which to use. P0 gives a switch. P1 gives an IR probe. See also G31 and G32.
M559: Upload configuration file
Example: M559
If the RepRap supports it, this uploads a file that is run on re-boot to configure the machine. This file usually is a special G Code file. After sending M559, the file should be sent, ending with an M29 (q.v.).
M560: Upload web page file
Example: M560
For RepRaps that have web support and that can be driven by a web browser, this uploads the file that is the control page for the RepRap. After sending M560 the file (usually an HTML file) should be sent, terminated by the string<!-- **EoF** -->. Clearly that string cannot exist in the body of the file, but can be put on the end to facilitate this process. This should not be too serious a restriction...
M561: Set Identity Transform
Example: M561
This cancels any bed-plane fitting as the result of probing (or anything else) and returns the machine to moving in the user's coordinate system.
M906: Set motor currents
Example: M906 X300 Y500 Z200 E350
Sets the currents to send to the stepper motors for each axis. The values are in milliamps.
M998: Request resend of line
Example: M998 P34
Request a resend of line 34. In some implementations the input-handling code overwrites the incomming G Code with this when it detects, for example, a checksum error. Then it leaves it up to the GCode interpreter actually to request the resend.
M999: Restart after being stopped by error
Example: M999
T: Select Tool
Example: T1
Select extruder number 1 to build with.
The sequence followed is:
- Set the current extruder to its standby temperature specified by G10 (see above),
- Set the new extruder to its operating temperature specified by G10 and wait for all temperatures to stabilise,
- Apply any X, Y, Z offset for the new extruder specified by G10,
- Use the new extruder.
Selecting a non-existent tool (100, say) just does Step 1. above. That is to say it leaves all tools in their standby state. You can, of course, use the G10 command beforehand to set that standby temperature to anything you like.
Note that you may wish to move to a parking position before executing a T command in order to allow the new extruder to reach temperature while not in contact with the print. It is acceptable for the firmware to apply a small offset [by convention (-1mm x tool-number) in Y] to the current position when the above sequence is entered to allow temperature changes to take effect just away from the parking position. Any such offset must, of course, be undone when the procedure finishes.
If the Z value changes in the offsets and the head moves up, then the Z move is made before the X and Y moves. If Z moves down, X and Y are done first.
After a reset extruders will not start heating until they are selected. You can either put them all at their standby temperature by selecting them in turn, or leave them off so they only come on if/when you first use them. The M0, M1 and M112 commands turn them all off. You can, of course, turn them all off with the M1 command, then turn some back on again. Don't forget also to turn on the heated bed (if any) if you use that trick.
Extruder numbering starts at 0.
Proposed SCARA calibration codes (Morgan)
In order to ease calibration of Reprap Morgan, the following M-codes are used to set the machine up Implemented in qharley/Marlin armlevel branch.
M360 : Move to Theta 0 degree position
The arms move into a position where the Theta steering arm is parallel to the top platform edge. The user then calibrates the position by moving the arms with the jog buttons in software like pronterface until it is perfectly parallel. Using M114 will then display the calibration offset that can then be programmed into the unit using M206 (Home offset) X represents Theta.
M361 : Move to Theta 90 degree position
Theta move to 90 degrees with platform edge. User calibrates by using jog arms to place exactly 90 degrees. Steps per degree can then be read out by using M114, and programmed using M92. X represents Theta. Program Y (Psi) to the same value initially. Remember to repeat M360 after adjusting steps per degree.
M362 : Move to Psi 0 degree position
Arms move to Psi 0 degree. Check only after other Theta calibrations
M363 : Move to Psi 90 degree position
Arms move to Psi 90 degree. Check only after other Theta calibrations
M364 : Move to Psi + Theta 90 degree position
Move arms to form a 90 degree angle between the inner and outer Psi arms. Calibrate by moving until angle is exactly 90 degree. Read out with M114, and calibrate value into Home offset M206. Psi is represented by Y.
M365 : SCARA scaling factor
Adjust X Y and Z scaling by entering the factor. 100% scaling (default) is represented by 1
M370 : Morgan manual bed level - clear map
Clear the map and prepare for calibration
M371 : Move to next calibration position
Move to the next position for calibration. User moves the bed towards the hotend until it just touches
M372 : Record calibration value, and move to next position
The position of the bed is recorded and the machine moves to the next position. Repeat until all positions programmed
M373 : End bed level calibration mode
M375 : Display matrix
Display the bed level calibration matrix
Store the calibration to EEPROM using M500
Proposed EEPROM configuration codes
BRIEFLY: each RepRap has a number of physical parameters that should be persistent, but easily configurable, such as extrusion steps/mm, various max values, etc. Those parameters are currently hardcoded in the firmware, so that a user has to modify, recompile and re-flash the firmware for any adjustments. These configs can be stored in MCU's EEPROM and modified via some M-codes. Please see the detailed proposal at M-codes for EEPROM config. (This is proposed by --AlexRa on 11-March-2011. There is currently no working implementation of the proposed commands).
Marlin uses these codes to manipulate EEPROM values.
Sprinter has implemented the following commands to manipulate EEPROM Commit message.
Teacup uses codes M130-M136 to set, read, and save some parameters.
M500: stores paramters in EEPROM
M501: reads parameters from EEPROM
If you need to reset them after you changed them temporarily
M502: reverts to the default "factory settings".
You still need to store them in EEPROM afterwards if you want to.
M503: Print settings
Replies from the RepRap machine to the host computer
All communication is in printable ASCII characters. Messages sent back to the host computer are terminated by a newline and look like this:
xx [line number to resend] [T:93.2 B:22.9] [C: X:9.2 Y:125.4 Z:3.7 E:1902.5] [Some debugging or other information may be here]
xx can be one of:
ok
rs
!!
ok means that no error has been detected.
rs means resend, and is followed by the line number to resend.
!! means that a hardware fault has been detected. The RepRap machine will shut down immediately after it has sent this message.
The T: and B: values are the temperature of the currently-selected extruder and the bed respectively, and are only sent in response to M105. If such temperatures don't exist (for example for an extruder that works at room temperature and doesn't have a sensor) then a value below absolute zero (-273oC) is returned.
C: means that coordinates follow. Those are the X: Y: etc values. These are only sent in response to M114 and M117.
The RepRap machine may also send lines that look like this:
// This is some debugging or other information on a line on its own. It may be sent at any time.
Such lines will always be preceded by //.
The most common response is simply:
ok
When the machine boots up it sends the string
start
once to the host before sending anything else. This should not be replaced or augmented by version numbers and the like. M115 (see above) requests those.
All this means that every line sent by RepRap to the host computer except the start line has a two-character prefix (one of ok, rs, !! or //). The machine should never send a line without such a prefix.
Exceptions: Marlin 1.0.0 Gen6 Firmware does not follow the two character rule. 'rs' is actually 'Resend' and '!!' is 'Error'.
Example Lines:
- Error: Line Number is not current line + 1. Last Line: 7
- Resend: 8
- Writing to File: print.gco
- Done saving file.
- File opened:print.gco Size:22992
- File selected
When in the code base did this change take place and what other firmwares are affected?
여러 줄의 G-코드를 전송하기 위한 제안
지금까지 토론이 열려서 나온 제안입니다.
해결해야 할 문제
통신 중 잠김 문제를 해소하기 위해 호스트에서 컨트롤러로 보내는 G-code의 각 줄은 다음 줄을 보내기 위해 ok 응답을 받았습니다. 이것은 오퍼레이션을 매우 느리게 만들며 일반적인 USB-TTL 변환기는 호스트의 운영체제의 디바이스 드라이버에서 10 m초 정도의 상당한 레이턴시를 갖습니다.
더 상세한 제안과 해결법, 의견을 위해 GCODE_buffer_multiline_proposal을 참조바란다.
Alternatives to G-code
- Main article: Firmware/Alternative#alternatives to G-code
- Wikipedia: STEP-NC: "STEP-NC was designed to replace ... G-codes ... adding tolerance data ... [with a] XML format."
- Elegant multispline motion controller "will not use G-code. It will use a custom language based on cubic Bezier curves. This allows for much better description of arcs and will result in much higher quality prints with a much lower data throughput requirements."
- GCODE buffer multiline proposal This may have some relevance to developers