Mitsubishi M700/M70 Programming & Macros
Overview: How Fanuc-Like Is It?
The Mitsubishi 700/70 Series (the MELDAS lineage — M700/M70 on most machining centers) speaks a dialect that is roughly 95% Fanuc Macro B. Programs use O-numbers, blocks use N-numbers, subprograms are called with M98/M99, macros with G65/G66, arguments map to local variables #1–#33, and the arithmetic and IF/GOTO/WHILE syntax carries straight over. Most Fanuc macros run with little or no editing. The differences worth knowing: a second modal call type (G66.1), programs callable by file name instead of O-number, far deeper WHILE nesting, both run-time timers counting in milliseconds, and a handful of Mitsubishi-only programming conveniences covered at the bottom of this page.
| Command | Function |
|---|---|
M98 P__ H__ L__ / M99 | Subprogram call/return. H = sequence number to start at, L = repetitions (1–9999). No argument passing; local variables are shared with the caller. |
M98 <FILE.NC> | Call a subprogram by file name (up to 32 characters, in angle brackets) instead of program number. Also works with G65/G66. |
M198 | Call a subprogram stored on an external device/HD. |
G65 P__ L__ <args> | Simple (one-shot) macro call with argument passing. Same as Fanuc. |
G66 P__ L__ <args> | Modal call A — macro runs after every movement block until G67. Same as Fanuc G66. |
G66.1 P__ L__ <args> | Modal call B — Mitsubishi-specific, see below. |
G67 | Cancel modal call. Must be paired with its G66/G66.1 in the same program. |
G100–G255, M/S/T/B codes | Parameter-set macro calls: up to 10 G codes and 10 M codes (plus all S, T, B codes) can be mapped to macro program numbers, so a custom cycle looks like a plain G or M code. |
G66.1 (modal call B) is the one to learn: between G66.1 and G67, every block is treated as if G65 P__ were written at its head — the block's own words (X, Y, F, even the last G code) are not executed but handed to the macro as arguments. N100 G01 X100. Y200. F400; in G66.1 mode behaves like G65 G01 X100. Y200. F400;. That lets a macro intercept and reinterpret ordinary-looking G-code — effectively a custom dialect. Uniquely, G, L, N, and P become usable argument addresses while G66.1 is modal.
Nesting: macro calls (G65/G66/G66.1) nest 4 deep with an independent set of local variables per level; M98 nests 8 deep (shared locals). Arguments cannot be passed to level 0 (the main program).
Macro Call Arguments
Argument specification I is identical to Fanuc — including the I, J, K alphabetical-order rule and the skips in the numbering. G, L, N, and P are only valid while G66.1 is modal; O is never usable.
| Address | Variable | Address | Variable |
|---|---|---|---|
| A | #1 | N | #14 (G66.1 only) |
| B | #2 | O | — (not usable) |
| C | #3 | P | #16 (G66.1 only) |
| D | #7 | Q | #17 |
| E | #8 | R | #18 |
| F | #9 | S | #19 |
| G | #10 (G66.1 only) | T | #20 |
| H | #11 | U | #21 |
| I | #4 | V | #22 |
| J | #5 | W | #23 |
| K | #6 | X | #24 |
| L | #12 (G66.1 only) | Y | #25 |
| M | #13 | Z | #26 |
Argument specification II (A_ B_ C_ I_ J_ K_ I_ J_ K_ ..., up to 10 I/J/K groups filling #4–#33) also matches Fanuc. If both styles hit the same variable in one call, the later address wins.
Variable Map
The layout mirrors Fanuc, but the common-variable count is option-dependent and can reach much higher than a typical Fanuc control. All common variables are retained through power-off (parameters #1128 RstVC1 / #1129 PwrVC1 can force-clear them on reset/power-up).
| Range | Type | Notes |
|---|---|---|
#0 | Vacant (null) | Read-only. #1=#0 makes #1 vacant. Vacant ≠ 0 for EQ/NE only. |
#1–#33 | Local variables | Per macro-call level (4 levels + level 0). Fixed cycles internally use #1–#32 as their own locals. |
#100–#199 | Common variables 2 | Per part system on multi-part-system machines. 100-set option stops at #149. |
#400–#499 | Common variables (option) | Only with the 700-set spec and parameter #1336 = 1; otherwise program error P241. |
#500–#999 | Common variables 1 | Shared across part systems. 100-set option stops at #549, 200-set at #599, 300-set at #699; 600/700-set specs give the full #500–#999. |
#1000 and up | System variables | Fixed by the control — see the next section. |
Expression rules match Fanuc: square brackets nest up to 5 deep, a variable reference is always treated as having a trailing decimal point, and negative variable numbers throw program error P241.
System Variables Worth Knowing
Verified against the IB-1500072 programming manual. Position variables end in the axis number (1 = X, 2 = Y, 3 = Z on a typical 3-axis mill).
| Variable | Usage |
|---|---|
| PLC Interface | |
#1000–#1035 | Macro interface inputs, PLC → NC (read-only; #1032 reads 32 bits at once) |
#1100–#1135 | Macro interface outputs, NC → PLC |
| Tool Compensation (read/write) | |
#10001+n / #2001+n | Tool length offset (type 1 / type 2 ranges; #2000-series caps at 200 tools) |
#11001+n / #2201+n | Tool length wear |
#16001+n / #2401+n | Tool radius offset (note: #16001, not Fanuc's #12001/#13001) |
#17001+n / #2601+n | Tool radius wear |
| Alarms, Timers & Control | |
#3000 | Programmable alarm: #3000=70 (MESSAGE), number 1–9999, message ≤ 31 chars, shows as P277 |
#3001 | Integrating timer 1 in milliseconds — counts whenever power is on; read/write |
#3002 | Integrating timer 2 in milliseconds — counts during automatic start (Fanuc's #3002 counts in hours; port carefully) |
#3003 | Suppress single block stop / M-S-T-B finish-signal wait (0–3) |
#3004 | Disable feed hold / feedrate override / G09 exact-stop check (bit 0/1/2) |
#3006 | Program stop with message: #3006=1 (MESSAGE) |
#3011 / #3012 | Date (YYYYMMDD) / time (HHMMSS) — read and write |
#3901 / #3902 | Parts count / required (maximum) parts count, 0–999999, writable |
| Modal Information | |
#4001–#4021 | G modals by group, pre-read block (#4001 motion, #4002 plane, #4003 abs/inc, #4006 inch/metric, #4012 work offset) |
#4201–#4221 | Same G modal groups for the block currently executing |
#4107/#4109/#4111/#4113/#4115/#4119/#4120 | Modal D, F, H, M, program No., S, T (execution-block twins at #4307+) |
| Position Information (last digit = axis No.) | |
#5001–#500n | Block end position of the previous block (workpiece coordinates) |
#5021–#502n | Current machine coordinate position |
#5041–#504n | Current workpiece coordinate position |
#5061–#506n | Skip coordinates — position where the G31 skip signal came in |
#5081–#508n | Active tool compensation amount |
#5101–#510n | Servo deviation (following error) |
| Work Offsets (read/write) | |
#5201–#520n | External workpiece offset (common shift; optional) |
#5221–#522n ... #5321–#532n | G54 through G59 work offsets — same numbers as Fanuc |
#7001–#700n ... | G54.1 extended offsets: P1 = #7001+, stride 20 per P number (P48 = #7941+, table continues into the #8000s through P72; the manual's table wraps P73–P96 back onto the P1–P24 numbers) |
Arithmetic & Control Flow
Operators and functions are the Fanuc set, plus a few extras. Everything below is straight from the manual's arithmetic-command list.
| Category | Available |
|---|---|
| Operators | + - * / MOD, bitwise AND OR XOR (32-bit) |
| Trig | SIN COS TAN ASIN ACOS ATAN (ATN accepted) — degrees |
| Rounding | ROUND (RND), FIX (truncate), FUP (round up), ABS |
| Other | SQRT (SQR), LN, EXP, BIN/BCD conversion |
| Comparisons | EQ NE GT LT GE LE — the manual warns to use EQ/NE on integers only; compare decimals with GE/GT/LE/LT |
| Branch / loop | IF [..] GOTO n; WHILE [..] DOm ... ENDm |
| Data output | POPEN / PCLOS / BPRNT / DPRNT — same as Fanuc |
The loop construct is where Mitsubishi pulls ahead of a stock Fanuc: DOm identifiers run from 1 to 127 and nest up to 27 levels (Fanuc Macro B allows DO1–DO3, 3 levels). Backward GOTO searches are slower than forward ones — structure loops to branch forward when you can.
Mitsubishi-Specific Features Worth Using
Figure rotation — M98 I_ J_ K_ P_ L_. Call a subprogram with a rotation center (I/J/K, incremental from the start point) and a repeat count L, and the control rotates the subprogram's entire toolpath around that center for each repetition — a bolt-circle or turbine-slot pattern from one programmed pocket, no math. Works with absolute or incremental subprograms; the rotation lives in the workpiece coordinate system.
Corner chamfering and rounding — ,C_ and ,R_. Append ,C3. or ,R5. to a linear block and the control inserts the chamfer or fillet at the corner formed with the next block, working from the imaginary corner intersection. Cutter comp is applied to the finished (chamfered) shape. Note the comma — a bare C is treated as an axis/argument word.
Geometric command — angle-defined lines. When you have an angle and an endpoint but no intersection coordinates, program the line with A (angle from the horizontal axis of the active plane) and let the control compute the corner: G01 A45. F500; followed by X100. Y30. A-10.; finds the intersection automatically. It can also find two-arc tangency points.
Circle cutting — G12/G13. One block bores a circular pocket: start at center, spiral out to radius I, full circle (CW for G12, CCW for G13), return to center, with an offset number D applied. G12 I25. D1 F300;
Programmed data setting — G10. Write offsets from the program instead of the offset screen: G10 L2 P1 X__ Y__ Z__ sets G54 (P1–P6 = G54–G59, P0 = external offset), G10 G54.1 Pn X__ Y__ Z__ sets extended offsets, and L10/L11/L12/L13 P_ R_ set tool length shape/wear and radius shape/wear. G90/G91 selects absolute or additive writes. G10 L3/L30 load tool-life management data.
Example 1: Tool Length Set by Skip (G31)
(TOUCH OFF T1 LENGTH ON A FIXED SENSOR)
G91 G28 Z0 T1 ;
M06 ;
#1 = #5003 ; (Z START POSITION, PREVIOUS BLOCK END)
G00 Z-400. ; (RAPID TO SAFE APPROACH)
G31 Z-150. F200 ; (FEED UNTIL SKIP SIGNAL)
#10001 = #5063 - #1 ; (LENGTH OFFSET 1 = SKIP POS - START)
G00 Z100. ;
M30 ;
#5063 latches the Z position at the instant the skip input fires, even though the block overtravels slightly. No allowance is made here for sensor delay.
Example 2: Bolt-Circle Drill Macro (G65 + WHILE)
(MAIN - 6 HOLES, 40MM RADIUS, FIRST AT 15 DEG)
G90 G54 G00 X0 Y0 ;
G43 H1 Z50. S2500 M03 ;
G65 P8010 A15. B40. H6 R5. Z-12. F250. ;
G00 Z100. M05 ;
M30 ;
O8010 (BOLT CIRCLE DRILL)
IF [#11 EQ #0] GOTO900 ; (H = HOLE COUNT REQUIRED)
#30 = 0 ;
WHILE [#30 LT #11] DO1 ;
#31 = #1 + 360. * #30 / #11 ;
G90 G00 X[#2 * COS[#31]] Y[#2 * SIN[#31]] ;
G98 G81 Z#26 R#18 F#9 ;
G80 ;
#30 = #30 + 1 ;
END1 ;
M99 ;
N900 #3000 = 101 (NO HOLE COUNT H) ;
A = #1, B = #2, F = #9, H = #11, R = #18, Z = #26 per the argument table. The #0 vacant check traps a forgotten argument with a readable alarm.
Example 3: Cycle-Time Stamp and Parts Count
(TOP OF PROGRAM)
#501 = #3001 ; (TIMER SNAPSHOT, MS)
#502 = #3012 ; (CLOCK-ON TIME HHMMSS)
(... MACHINING ...)
(END OF PROGRAM)
#503 = [#3001 - #501] / 1000 ; (CYCLE SECONDS)
IF [#3901 LT #3902] GOTO10 ;
#3006 = 1 (PART COUNT REACHED) ; (STOP WHEN COUNT HITS TARGET)
N10 M30 ;
Remember #3001 and #3002 are both millisecond counters here — a Fanuc habit of reading #3002 as hours will be off by a factor of 3.6 million.
References
- Mitsubishi Electric, MITSUBISHI CNC 700/70 Series Programming Manual (Machining Center System), IB-1500072, Mitsubishi Electric Corporation.
Have a question or want to contribute?
Contact us with corrections, additions, or topics you'd like covered.
Get in Touch