Problem Scope
An older Colchester Tornado turning centre is documented as supporting Custom Macro B (user macro / parametric programming), but the macro programming manual is missing from the machine documentation set. The machine tag identifies the control only as "OTC". Without a control-specific manual you cannot safely assume which variable ranges, system variables, or control statements are implemented, because macro dialects differ between control generations even inside one control family.
This reference gives a repeatable path: identify the exact control, verify the macro option is actually enabled in that specific machine's configuration, then validate each language element empirically before it is used in production code.
Step 1 - Identify the Control Precisely
- Open the CNC diagnostic/system information screen (typically reached from a SYSTEM, SERVICE or DIAGNOSIS soft key). Record the exact series designation and software/firmware version strings shown, character for character.
- Open the electrical cabinet and record the CNC main board and I/O module part numbers from their labels. These part numbers are the most reliable cross-reference when the software screen is uninformative.
- Record the machine serial number and build year from the machine plate. Documentation for a turning centre is usually issued per serial number block, and the correct macro manual is the one matching that block.
- Contact the machine builder's or CNC manufacturer's official service organisation with the serial number plus the control identification strings, and request the parametric/custom macro programming manual for that exact software version.
| Data to capture | Where it lives | Why it matters |
|---|---|---|
| CNC series + software version | System/diagnosis info screen | Selects the correct manual revision |
| CNC board part numbers | Control cabinet labels | Cross-reference when screen data is incomplete |
| Installed option list | Option/parameter display | Confirms macro option is present, not just "supported" |
| Machine serial number | Machine nameplate | Ties documentation to this build |
| Parameter backup | Memory card / serial dump | Rollback point before any parameter change |
Step 2 - Confirm the Macro Option Is Enabled
"The machine can do it" in a sales brochure and "the option bit is set in this control" are different statements. Custom Macro B is normally an ordered option; a machine can ship with the capability listed and the option disabled.
- Back up all parameters first. Dump the full parameter set to a memory card or through the serial port, and also photograph the option/parameter screens. Never probe macro behaviour without a verified restore path.
- Check the option display. Locate the control's option or installed-function list and look for a user macro / custom macro entry.
- Run a non-cutting probe program. Load a program that only assigns and displays a variable, with no axis motion and no spindle command, and run it in a safe state (single block, feed hold ready, no tool loaded, machine locked if the control supports it).
O9001 (MACRO OPTION PROBE - NO MOTION)
#100 = 1.0
#101 = #100 + 2.0
M30
%
Open the macro variable display page and read #101. If it shows 3.0, arithmetic assignment is executing. If the control throws an alarm on the # character or reports an unusable command, the option is not enabled or the addressing differs on this control. Record the exact alarm number and text; that alarm number is the single most useful item when you contact support.
Step 3 - Custom Macro B Language Elements to Verify
The table below lists the elements a Custom Macro B implementation typically provides. Treat every row as a hypothesis for your specific control and confirm it with the probe method above or with the manual once it arrives. Do not assume a range is available just because it appears here.
| Element | Typical form | Verification method |
|---|---|---|
| Local variables |
#1-#33, argument passing into a macro call, cleared on return |
Call a macro with arguments, read locals in the macro body |
| Common variables (volatile) |
#100-#199, cleared at power off on most controls |
Write a value, power cycle, re-read |
| Common variables (retained) |
#500-#999, retained through power off |
Write a value, power cycle, re-read |
| System variables |
#1000 and above: interface signals, tool offsets, work offsets, position data, alarms, clock |
Read only, one address at a time, against the manual's map |
| Vacant value |
#0 reads as vacant/null; comparison behaviour is control-specific |
Test explicitly before relying on null logic |
| Macro call |
G65 P_ L_ A_ B_ C_ ... single (non-modal) call |
Call a display-only macro and read the received arguments |
| Modal call |
G66 / cancel with G67
|
Verify cancel behaviour before any motion use |
| Arithmetic |
+ - * /, SIN, COS, TAN, ATAN, SQRT, ABS, ROUND, FIX, FUP
|
Assign to #100, read result on the variable page |
| Branching |
IF [ ... ] GOTO n, IF [ ... ] THEN
|
Set a flag variable in each branch and read it |
| Looping |
WHILE [ ... ] DO m ... END m, nesting depth limited |
Counter loop with no motion; check final counter value |
| Operators |
EQ NE GT LT GE LE, logical AND OR XOR
|
Truth-table style probe program |
| Alarm / message output | Macro alarm and operator message commands | Trigger deliberately; confirm the message reaches the screen |
Step 4 - Structured Validation Program
Use one throwaway program per language feature, all motion-free. Keep them in a dedicated program number block (for example O9000-O9010) so they are easy to purge afterwards.
O9002 (BRANCH AND LOOP PROBE - NO MOTION)
#100 = 0 (LOOP COUNTER)
#101 = 0 (BRANCH FLAG)
WHILE [#100 LT 5] DO 1
#100 = #100 + 1
END 1
IF [#100 EQ 5] GOTO 100
#101 = 99 (SHOULD NOT REACH)
GOTO 200
N100 #101 = 1 (BRANCH TAKEN OK)
N200 M30
%
Expected result on a working implementation: #100 = 5 and #101 = 1. Any other outcome means the comparison operators, the loop syntax, or the label handling differ on this control, and you must stop and get the manual before writing production macros.
Step 5 - Production Rules for This Machine
-
Reserve variable ranges by function. Document which retained variables (
#500block) are used for what, in a text file kept with the machine. Retained variables are a shared global resource; an undocumented overwrite between two macro programs is one of the hardest CNC faults to trace. - Never write to a system variable until it is read-verified. Read it, log the value, confirm it matches what the screen shows for that offset or signal, and only then consider writing.
-
Guard every calculated motion. Before a block such as
G1 X#101 F#102, insert range checks that raise a macro alarm if the variable is outside the machine's usable travel or feed window. A vacant or stale variable otherwise becomes a commanded coordinate. - Prove new macros with the machine locked / dry run and single block, watching the distance-to-go and the variable page, before any cutting trial.
- Back up parameters and macro programs together. Macro logic that depends on retained variables is not restorable from the program text alone; the variable contents are part of the machine state.
- Test power-cycle behaviour explicitly. Confirm which of your working variables survive power off on this control before designing counters, tool-life logic, or part counters around them.
If the Manual Cannot Be Obtained
If the builder's and CNC manufacturer's official service channels cannot supply the macro manual for that software version, treat the control as having an unverified macro dialect and constrain what you deploy:
- Use only the language elements you have proved with motion-free probe programs.
- Avoid system variables entirely except those you can cross-check against a visible screen value.
- Avoid modal macro calls; use single
G65calls where the scope is explicit. - Keep macro nesting shallow, since nesting limits are control-specific and exceeding them usually produces an obscure alarm mid-cycle.
- Maintain a written test record: probe program number, expected value, observed value, date, control software version. That record becomes your de facto manual for this machine.
FAQ
How do I tell if Custom Macro B is enabled on my CNC lathe?
Check the control's installed-option list, then run a motion-free probe program that assigns #100 = 1.0 and #101 = #100 + 2.0, and read #101 on the macro variable page. If it shows 3.0 the option is active; if the control alarms on the # character, record the alarm number and query support with it.
Which macro variables survive a power cycle?
Retained common variables (commonly the #500-#999 block) normally persist through power off, while the #100-#199 block is typically cleared. Verify this on your specific control by writing a value, powering down, and re-reading it before designing part counters or tool-life logic.
What information does the manufacturer need to supply the correct macro manual?
Provide the machine serial number, the CNC series designation and software/firmware version exactly as shown on the system information screen, and the CNC board part numbers from the cabinet labels. Manual revisions are keyed to software version, not to the machine badge.
Is it safe to test macro syntax on the machine itself?
Yes, if the test program contains no axis motion, no spindle command, no tool in the spindle or turret position of concern, and you run it in single block with the machine locked or in dry run where supported. Always dump the full parameter set to external media first.
Can I copy macro programs from another machine with a similar control?
Only after verifying each language element on the target control with probe programs. Variable ranges, system variable maps, nesting limits, and null-value comparison behaviour differ between control generations, and a system variable that reads a tool offset on one control may address something else on another.