Custom Macro B Quick Reference

 

__Use__MachMotion_Logo_HiRes_TransBG-update-01-450.png

Calling Words Examples
M98 - Subroutine Call M98 P1000 (Call subprogram O1000)
G65 - Custom macro call G65 P1000 A0.3 B5.0 C2.3 (Call custom macro O1000 with arguments)
G66 - Custom macro modal call  G65 P1000 A0.3 B5.0 C2.3 L5 (Execute custom macro O1000)
G66.1 - Custom macro modal call G66 P1000 X3.4 Y1.2 Z3.2 (Set arguments for custom macro O1000)
G67 - Modal call cancel G66.1 P1000 U1.3 V2.2 W1.1 (Modal call to custom macro O1000)
M99 - End of custom macro G67 (Cancel either modal call)
P Word Program number being called (Note: See Manual to learn the differences between G66 and G66.1)
L Word Number of executions

Custom Macro Arguments (Assignment number one)

A, B, C, D, E, F, H, I, J, K, M, Q, R, S, T, U, V, W, X, Y, Z (Avoid I, J, and K if possible. see manual for reasons.)

Local Variable Assignments (Assignment 1)

A: #1, B: #2, C: #3, D: #7, E: #8, F: #9, H: #11, I: #4, J: #5, K: #6, M: #13, Q: #17, R: #18, S: #19, T: #20, U: #21, V: #22, W: #23,  X: #24, Y: #25, Z: #26

Common Variables

Common Variables Option A Option B Option C
Common Variables #100 - #149 #100 - #199 #100 - #199
Permanent Common Variables #500 - #549 #500 - #599 #500 - #699

System Variables 

#0 - NIL
#1000 - #1035 ... Input signals
#1100 - #1135 ... Output signals
#2000 - #2999 ... Tool Offsets
#3000 ... Alarm Generation
#3001 ... milliseconds Timer
#3002 ... Hour Timer
#3003 ... Single block suppression & M code wait
#3004 ... Feed hold, Feedrate override
#3006 ... Stop with message
#3007 ... Mirror image on/off
#4001 - #4120 ... Modal information
#5001 - #5015 ... Current absolute Position
#5021 - #5035 ... Current machine position
#5061 - #5075 ... Current absolute position at G31
#5201 - #5335 ... Fixture offsets
Note: For OM controls, #2501 - 2623 are related to and exact stop check suppression fixture offsets

Arithmetic

Priority:
1. Brackets
2. Functions
3. Multiply
4. Divide
5. Add
6. Subtract

Function Symbol Example
Equality = #100 = 3
Addition + #100 = 3 + 6
Subtraction - #100 = 3 - 2
Multiplication * #100 = 3 * 4
Division / #100 = 9 / 3
Absolute Value ABS #100 = ABS [2-5]
Rounding ROUND

#100 = ROUND [4.4]

Round Down FIX

#100 = FIX [4.8]

Round Up FUP

#100 = FUP [3.2]

Sine SIN

#100 = SIN [45]

Cosine COS

#100 = COS [45]

Tangent TAN

#100 = TAN [45]

Arc Tangent ATAN

#100 = ATAN [3] / [9]

Square Root SQRT

#100 = SQRT [9]

Arc Cosine ACOS

#100 = ACOS [.23]

Logrisms LN

#100 = LN [2.3]

Exponent EXP

#100 = EXP [3]

Decimal Adding ADP

#100 = ADP [#3]

Logic Statements:

Statement Label: N Word
Unconditional Branching: GOTO
Conditional Branching: IF
Looping: WHILE

Logical Operators:

Equal To: EQ
Not Equal To: NE
Less Than: LT
Greater Than: GT
Less Than or Equal To: LE
Greater Than or Equal To: GE

System Variables

#1000 - #1035: Input signals for device interface
#1000: Corresponds to input signal UI000
#1001: Corresponds to Input signal UI001 
#1031: Corresponds to input signal UI031

#1100 - #1135: Output signals for device interface
#1100: Corresponds to input signal UO000
#1101: Corresponds to input signal UO001
#1131: Corresponds to input signal UO031

#2000 - #2999: Tool Offsets (Machining Centers)
(For Machining centers having one value per offset)
#2001: Offset 1
#2002: Offset 2
#2003: Offset 3
.
#2199: Offset 199



#2000 - #2999: Tool Offsets (Turning Centers)

Wear Offsets
# X Y R T
1 #2001 #2101 #2201 #2301
2 #2002 #2102 #2202 #2302
3 #2003 #2103 #2203 #2303
. . . . .
32 #2032 #2132 #2232 #2332
Geometry Offsets
# X Y R T
1 #2401 #2501 #2601  
2 #2402 #2502 #2602  
3 #2403 #2503 #2603  
  . . .  
32 #2432 #2532 #2632  
#3000: Alarm Generation Ex.: #3000 = 100 (TOOL TO BIG) 26 characters in message, alarm no. 100-255
#3006: Stop w/ Message Ex.: #3006 = 100 (CLEAR CHIPS) 26 characters in message, alarm no. 100-255
#3001: Millisecond timer #3001 = 0 (Resets Timer)  
#3002: Hour Timer #3002 = 0 (Resets Timer)  
#3003: Suppress single block #3003 = 0 (Enable single block) #3003 = 1 (Disable single block)
#3003: M code Await #3003 = 0 (Await M codes) #3003 = 2 (Don't await M codes)
#3004: Suppress feed hold #3003 = 0 (Enable feed hold)

#3004 = 1 (Disable feed hold)

#3004: Suppress feed override #3003 = 0 (Enable feed override)

#3004 = 2 (Disable feedrate override)

#4000 - #4130: Current states (Machining Centers)
#4001: G00
#4002: G17
#4003: G90
#4004: G22
#4005: G94
#4006: G20
#4007: G40
#4008: G43
#4009: G80
#4010: G98
#4011: G50
#4012: G66
#4013: G95
#4014: G54
#4015: G61
#4016: G68

#4000- #4130: Current states (Turning Centers)
#4001: G00
#4002: G96
#4003: ABS
#4004: G68
#4005: G98
#4006: G20
#4007: G40
#4008: G25

Machine & Turning
#4102: B
#4107: D
#4108: E
#4109: F
#4111: H
#4113: M
#4114: N
#4115: O
#4119: S
#4120: T
#4130: Additional fixture offset number

#5201 - #5335: Fixture offsets (Not 0 Series)

Offset X Y Z
Common #5201 #5202 #5203
G54 #5221 #5222 #5223
G55 #5241 #5242 #5243
G56 #5261 #5262 #5263
G57 #5281 #5282 #5283
G58 #5301 #5301 #5303
G59 #5321 #5302 #5323


#2501 - #2523: Fixture offsets (For 0 Series)

Offset X Y Z
G54 #2501 #2502 #2503
G55 #2521 #2522 #2523
G56 #2541 #2542 #2543
G57 #2561 #2562 #2563
G58 #2581 #2582 #2583
G59 #2601 #2602 #2603

 

G Codes:
G00 & G01: Motion Commands
G10: Offset setting
G20 & G21: Inch & Metric Modes
G31: Skip cutting
G49: Cancel tool length comp.
G50: Turning center program zero
G53: Motion relative to zero return
G54-G59: Fixture offsets
G65: Custom macro call
G66: Modal custom macro call
G67: Cancel modal call
G90: Absolute Mode
G91: Incremental mode
G92: Machining center program zero
G98: Turning center feed per minute
G99: Turning center feed per revolution

M codes:
M00: Program stop
M01: Optional stop
M03: Spindle on CW
M04: Spindle on CCW
M05: Spindle Stop
M13: Activate Probe
M14: Deactivate Probe
M19: Spindle orient
M98: Subprogram call
M99: Subprogram return

Calibration values:
#500 Stylus Radius
#501: X+ Overshoot & droop
#502: X- Overshoot & droop
#503: Y+ Overshoot & droop
#504: Y- Overshoot & droop
#505: Probe length

Special Program Numbers:
O9000: T code calling
O9001-O9009: Mcode calling
O9010-O9020: G code calling

External Output commands:
POPEN: Open RS-232C port
PCLOS: Close RS-232C port
BPRNT: Print (no deimal point)
DPRNT: Print (with decimal point)

Naming #500 series variables:
SETVN 500 [RADIUS]
SETVN 501 [X+ O&D]
SETVN 502 [X- O&D]
SETVN 503 [Y+ O&D]
SETVN 504 [Y- O&D]
SETVN 505 [LENGTH]

Please reference this link for more information about Macro B programming.
Macro B Manual

Back to top