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

_______________________________________________________














LOGIN below to POST your questions and comments on AjaxCNC products.

Moderator: cnckeith

Post Reply
diycncscott
Posts: 633
Joined: Thu Mar 04, 2010 4:03 pm

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

Post by diycncscott » Wed Sep 04, 2013 8:21 am

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

Who is online

Users browsing this forum: No registered users and 3 guests