Mach Macros- M function macro to turn output On/Off

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
diycncscott

Mach Macros- M function macro to turn output On/Off

Post by diycncscott »

All Mach M -function macros should be saved to c:\Mach3\macros\Mach3Mill. For example, if you would to call the M function macro M10 from g code, save the file M10.M1s in the above directory.

The examples below will turn on Output 6 (labeled "Clamp" on ALLIN1DC) when an M10 is issued and turn it off when an M11 is issued.

First macro M10.m1s:

'M10 Turn on Output 6
Dim Output6On As Boolean

SetMasterOutput(6, 1)
Output6On = GetMasterOutput(6)

'Wait for output to turn on
While Not (Output6On)
sleep 100
Output6On = GetMasterOutput(6)
Wend



Second macro M11.m1s:

'M11 Turn off Output 6
Dim Output6On As Boolean


SetMasterOutput(6, 0)
Output6On = GetMasterOutput(6)

'Wait for output to turn on
While (Output6On)
sleep 100
Output6On = GetMasterOutput(6)
Wend
Post Reply