Controlling SCF4 with G-code commands explanation and usage examples

Axis description

Driver support bipolar stepper motors for 3 axes. They are named A/B/C and usually have defined function:

Resources

$S - Return version string

Command returns version string concentrated into single line [EVB.1.0.2, SCF4-M RevB, Kurokesu, 5DDFF39-3739584E-xxxxxxxx] received information is comma separated:

G0 - Rapid positioning

The main motor drive command. It moves motor specified number steps. Any or all axes can be specified at the same time. Minimal step size is 1. G0 command replies as soon as the command is parsed and does not wait until motors stop.

G4 - Wait

Instructs controller to delay (stall) defined interval in milliseconds [ms]. This is an only command which sends response not after parsing command but after prolonged execution time. During this time command parser is blocked and the only way to complete this command is to wait until it finishes.

G90 - Relative coordiantes

Switch to relative coordinate programming mode. Motors can be instructed to turn positive or negative 0 ~ 65535 steps (16-bits). When the counter exceeds this range, it will overflow. And will not affect motor movement.

G91 - Absolute coordiantes

Switch to absolute coordinate programming mode. In this mode, the range is limited by the internal 16-bit motor register and can be operated in a range of 0 ~ 65535.

G92 - Set position

The controller sets an internal counter to the specified value.

M0 - Compulsory stop

If the controller is not in G4 delay mode it will instruct motors to stop moving

M7 and M8 - Infrared filter switch commands

Instructs controller to shift filter one of two fixed positions

M230 and M231 - normal / forced move

M232 - Set PI low/high detection voltage

Set 12bit comparator values for limit switch detection inputs. Upper voltage is 3.3V, lower - 0V

M234 - Set motor and DN drive current

Sets motor and coil drive current. Expects 8-bit value.

M235 - Set motor idle current

When motors are not moving, idle current can be reduced to eliminate heating and save energy. It is not advised to completely turn off motors as the driver can lose micro-step holding position

M238 and M239 - control output pins

Opto-interrupter LEDs can be controlled by connecting them to PIS_AB and PIS_C pins. They can stay in either state, but some lenses in IR mode can leak light into the sensor so after referencing/calibration procedure is complete it is advised to switch them off

M240 - Set motor drive speed

Each motor can drive at different speeds. Speed is 16-bit register. Register specifies internal timing interval, the lower value is the faster pulse rate will be.

M241, M242, M243, M244 - advanced timing registers

!1 - Return status

Command returns 9 values indicating: