M-Code-Commands List
Command | Short Description |
---|---|
click tensioner | advance feeder by it's configured default advance length |
M600 | Advance a Feeder |
M601 | Retract after Pick |
M602 | Feeder is OK? |
M603 | Drive servo to a specific angle |
M610 | Enable/Disable feeder globally (call before/after any feed operation) |
M620 | Update feeder config |
M143 | Get ADC raw values |
M144 | Get ADC scaled values |
M145 | Set scaling factors and offsets |
M155 | Switch digital IOs for power output |
M799 | Factory Reset |
Clicking Tensioner
This is obviously not an M-Command but very useful for setting up a feeder. First enable the feeder. Afterwards if pressing the tensioner short, the feeder advances by it's configured default length. This is very useful to load a new reel and setting up the feeder. Fot this feature the feedbackline is used, so it works only for the native shield.
Usage
- Press down the tensioner to make the microswitch toggle. A duration between 50ms and 500ms is detected as a valid command to feed.
Examples
M610 S1 ; enable feeder, power on press tensioner.
M610: Enable Feeder
Command issued before any feeder shall be used. Turns a mosfet wired to FEEDER_ENABLE_PIN on/off
Usage
M610 S<status>
Argument | Description |
---|---|
S<status> | 1 → On, 0 → Off |
Examples
M610 S1 ; enable feeder, power on M610 S0 ; disable feeder, power off
M600: Advance
Command issued to advance tape by one feeder.
Usage
M600 N<index of feeder> F<feedlength>
Argument | Description |
---|---|
N<index of feeder> | Number of Feeder: 0…NUMBER_OF_FEEDER |
F<feedlength> | Feedlength, optional: If given, has to be a multiple of 2 mm, 24mm maximum |
X<override error> | If feedback line presents an error for feeder, it is temporarily ignored with X1 |
Example commands
M600 N3 F4 ; Advance Feeder No. 4 (0 based index) on port F3 by 4mm M600 N0 ; Advance Feeder No. 0 (port F1) by FEEDER_MECHANICAL_ADVANCE_LENGTH (mechanical default) M600 N11 ; Advance Feeder No. 11 (F12) by 2 mm (feeder holds on half way at configured HALF_ADVANCED_ANGLE), might need to be tweaked for accuracy
M620: Set feeder config
Tweak feeder parameters for specific servo, to improve accuracy, etc.
Usage
M620 N<index of feeder> A<advanced angle> B<half advanced angle> C<retract angle> F<default feed length> U<settle time> V<min. pulsewidth> W<max. pulsewidth> X<ignore feedback pin>
Argument | Description |
---|---|
N | Number of Feeder: 0…(NUMBER_OF_FEEDERS-1) |
A | advanced angle, defaults to FEEDER_DEFAULT_FULL_ADVANCED_ANGLE |
B | half advanced angle, defaults to FEEDER_DEFAULT_HALF_ADVANCED_ANGLE |
C | retract angle, defaults to FEEDER_DEFAULT_RETRACT_ANGLE |
F | standard feed length, defaults to FEEDER_DEFAULT_FEED_LENGTH, which is FEEDER_MECHANICAL_ADVANCE_LENGTH, which is 4mm usually |
U | settle time to go from advanced angle to retract angle and reverse, defaults to FEEDER_DEFAULT_TIME_TO_SETTLE. make sure the servo is fast enough to reach the angles within given settle time |
V | pulsewidth at which servo is at about 0°, defaults to FEEDER_DEFAULT_MOTOR_MIN_PULSEWIDTH |
W | pulsewidth at which servo is at about 180°, defaults to FEEDER_DEFAULT_MOTOR_MAX_PULSEWIDTH |
X | ignore feedback pin, defaults to FEEDER_DEFAULT_IGNORE_FEEDBACK |
Examples
M620 N18 A90 B40 C20 F4 U240 V544 W2400 X0 ; set new settings for feeder index 18 and store to eeprom
M602: Report Feeder is operational?
Command issued to check feeder. Status of feeder is printed to console.
Usage
N<feeder index>
Argument | Description |
---|---|
N<feeder index> | which feeder to check? |
Example
M602 N3 ; check feedback line and print status of feeder 3
M603: Set Servo to Angle
While setting up the feeder, it is useful to bring the servo to a defined angle. For this reason, this command was implemented.
Usage
M600 N<index of feeder> A<angle>
Argument | Description |
---|---|
N<index of feeder> | Number of Feeder: 0…NUMBER_OF_FEEDER |
A<angle> | Angle to set servo to. Must be beween 0-180°. If omitted, defaults to 90°. |
Example commands
M603 N2 A44 ; Set servo for feeder no. 2 (port F3) to 44° M603 N0 ; Set servo for feeder no. 1 to default (90°)
M799: Factory Reset
Invalidate EEPROM and restore default settings given from config.h. No parameters, no safety questions!
M143: Report Analog Input Raw Value
Read out raw values from ADC and report.
Usage
M143 A<analog input pin>
Argument | Description |
---|---|
A<analog input pin> | 0, 1 for vacuum sensors, 2…7 for adc aux |
Example
M143 A0 ; report vacuum sensor 0
M144: Read Analog Input, return scaled value
Read out scaled values from ADC instead raw values. Scaling factors are printed to console on startup of microcontroller.
Usage
M144 A<analog input pin>
Argument | Description |
---|---|
A<analog input pin> | 0, 1 for vacuum sensors, 2…7 for adc aux |
Example
M144 A0 ; report vacuum sensor 0
M145: Set Analog Input Scaling Factor and Offset
Set scaling factor and offset to convert raw values from adc to real units.
Usage
M145 A<analog input pin> S<scale factor> O<offset>
Argument | Description |
---|---|
A<analog input pin> | 0, 1 for vacuum sensors, 2…7 for adc aux |
S<scale factor> | scaling factor, multiplied with raw value read from adc |
O<offset> | offset, added to raw value read from adc. can be negative |
Examples
M145 A3 S1.00 O0.00
→ Set scaling to 1 offset to 0 for A3 (that is no scaling active)M145 A0 S0.1277 O-120.23
→ Set scaling to 0.1277 offset to -120.23 for A0 (scale example for NXP vacuum sensors)
M155: Switch Mosfet-Power Output
Usage
M155 D<digital io index> S<state>
Argument | Description |
---|---|
D<digital io index> | digital output to switch, see config.h for maptable |
S<state> | turn on (1) or off (0) |
Examples
M155 D0 S1 ; turn on output D0 mapped to pin via config.h M155 D2 S0 ; turn off output D2 mapped to pin via config.h