This is the manual of Studio 1.1.0, an earlier version. The manual of the latest version
Documentation 1.1.0 Technical manual
The Twinwright controller
The Twinwright controller (kernel) is Twinwright's own CNC controller firmware. In Studio it runs the twin's machine. The same code is built for the MC-1's controller board.
It speaks the Grbl 1.1 serial protocol, so G-code senders work with it. Settings, alarms and errors keep the numbers senders know.
What it does
- Motion: look-ahead planning over 100 blocks, corner speeds from
$11, and arcs on the true circle. Motion runs in 1 ms slices. Each axis keeps to its maximum rate ($110–$112) and acceleration ($120–$122). - Machine functions:
- homing, hard and soft limits, probing and the tool setter;
- the spindle drive (VFD) over Modbus, and coolant;
- tool changes as
$341sets them; - the safety door with parking;
- overrides, jogging and the handwheel.
- Programs on the controller: programs on its file system run with O-word subroutines and macros (see O-words).
- G-code: RS274/NGC and LinuxCNC. This includes a tool table, cutter radius compensation, path blending, expressions and parameters (see G-code and M-code).
The serial protocol, the real-time commands and the $ commands are in Protocol. Every setting is in Settings, every alarm in Alarm codes, and every error in Error codes.
Compared with other Grbl controllers
Senders written for Grbl work with the controller. This section lists what you notice when you are used to another Grbl controller.
Where the controller stops
In these cases some Grbl controllers carry on; the Twinwright controller stops or raises an alarm.
- The spindle drive stops by itself (a trip, an overload, or its own stop key): the feed stops within 0.2 s, and the controller raises
ALARM:14. - The spindle drive does not answer: the axes slow down to a stop first, so the position is kept. Then the controller raises
ALARM:19. - Tool change:
- The spindle always stops for a tool change.
- If a tool change goes on without a confirmation, the spindle and coolant come back as they were.
- Resume after a feed hold or the door: the spindle reaches its speed before the tool moves.
- The door opens again while the machine returns from parking: the machine stops and rises to the parking height again. It waits for the next cycle start.
- The sender is lost (USB unplugged, the port closed): the job stops.
$1030controls this; it is on by default. - Probe and homing switches: glitches on the wires do not count as a touch.
- UTF-8 text in a program (Chinese, "Ø", "–") is read as text, never as a real-time command.
- An R-form arc with no chord in its plane, for example
G91 G2 X0 Z1 R5, answerserror:33.
More G-code
Some Grbl controllers refuse or ignore these; the Twinwright controller runs them as the standards define them:
- the tool table (
G43 Hn,G43.2,G10 L1/L10/L11); - cutter radius compensation (
G41,G42); - path blending (
G64 P) and exact stop (G61.1); - O-word subroutines and control flow,
#parameters and expressions; G52, polar coordinates (@,^) andM99;G85,G86andG89drill and bore, where some Grbl controllers accept them and do not move;- what CAM post-processors often write: a
%line with a name,G49 H0, Fanuc program number lines (O1000) and Centroid'sM25.
Closer to the program
- Arcs follow the true circle. Some Grbl controllers cut them into chords up to 4 ×
$12off the circle. - Arcs in inverse time (
G93) take the programmed time. Some Grbl controllers run them several times faster. - Dwells (
G4) last as long as programmed. Some Grbl controllers round them to 50 ms steps. - Peck drilling: each hole gets the pecks it needs. When the depth is a whole number of pecks, some Grbl controllers drill one more full peck from the retract height.
- Large arcs near the soft limits do not raise false alarms.
M72restores the tool length offset thatM70orM73saved. Some Grbl controllers keep a later offset when the saved one was 0 in the same offset mode (G43.1), so afterM72the same program can run there with another tool length offset.- Acceleration: every axis keeps to
$120–$122, also on small arcs. A program with very many small arcs can take up to about 2 % longer than on some Grbl controllers. An ordinary program takes about 0.1 % less.
Protocol details
- Status reports:
- In a feed hold or with the door open, the feed in
FS:is 0: the axes stand. - The distance to go is reported until the axes stop.
- During a critical alarm,
Bf:shows the planner empty. - With the parser state on in
$10,[GC:]comes once per change.
- In a feed hold or with the door open, the feed in
- Input checks:
- A bad setting number such as
$45xanswerserror:3. - An integer setting written as
$1=25.0stores 25; some Grbl controllers store 250. M6and a motion in one line answererror:40.G65orG66with other commands in one line answererror:21.
- A bad setting number such as
- Alarms and start-up:
- There is no 100 ms pause after an alarm.
- The first start with empty settings storage does not answer
error:7.
- Texts and settings:
- The descriptions of settings, alarms and errors are Twinwright's own.
- The controller has settings of its own:
$1030(stop when the sender is lost), and$1000and up for input shaping (off by default).
$39=0(legacy real-time characters off):?,!and~are text inside$lines and comments, and commands everywhere else. The controller decides from the bytes as they arrive. So it answers?also with the door open or in a feed hold, where some Grbl controllers sometimes do not.
Not supported
G65 P7(Modbus messages).- Fanuc system variables.
#4120and the like are ordinary parameters and read 0. - Threading (
G33,G76,G33.1) without a spindle encoder. The MC-1 has none, so these answererror:20. - Lathe roughing cycles (other Grbl controllers have none either).
- Networking, Trinamic drivers and other makes of spindle drive, which some Grbl controllers add as plug-ins.
Senders
The senders that were checked, and their settings, are in G-code senders. To compare a real machine with its twin, see Real machine and shadow mode.