Haas M109 INTERACTIVE USER INPUT – Haas Mill

Haas M109 INTERACTIVE USER INPUT

M109 M code allows a G-code program to place a short prompt (message) on the screen. A macro variable in the range 500 through 599 must be specified by a P code. The program can check for any character that can be entered from the keyboard by comparing with the decimal equivalent of the ASCII character (G47, Text Engraving, has a list of ASCII characters).

How to Clear All Offsets on a Haas Machine Tool

How to Clear All Offsets on a Haas Machine Tool

M109 Example Programs

The following sample program will ask the user a Yes or No question, then wait for either a “Y” or an “N” to be entered. All other characters will be ignored.

N1 #501= 0. (Clear the variable)
N5 M109 P501 (Sleep 1 min?)
IF [ #501 EQ 0. ] GOTO5 (Wait for a key)
IF [ #501 EQ 89. ] GOTO10 (Y)
IF [ #501 EQ 78. ] GOTO20 (N)
GOTO1 (Keep checking)
N10 (A Y was entered)
M95 (00:01)
GOTO30
N20 (An N was entered)
G04 P1. (Do nothing for 1 second)
N30 (Stop)
M30

The following sample program will ask the user to select a number, then wait for a 1, 2, 3, 4 or a 5 to be entered; all other characters will be ignored.

%
O01234 (M109 Program)
N1 #501= 0 (Clear Variable #501)
(Variable #501 will be checked)
(Operator enters one of the following selections)
N5 M109 P501 (1,2,3,4,5)
IF [ #501 EQ 0 ] GOTO5
(Wait for keyboard entry loop until entry)
(Decimal equivalent from 49-53 represent 1-5)
IF [ #501 EQ 49 ] GOTO10 (1 was entered go to N10)
IF [ #501 EQ 50 ] GOTO20 (2 was entered go to N20)
IF [ #501 EQ 51 ] GOTO30 (3 was entered go to N30)
IF [ #501 EQ 52 ] GOTO40 (4 was entered go to N40)
IF [ #501 EQ 53 ] GOTO50 (5 was entered go to N50)
GOTO1 (Keep checking for user input loop until found)
N10
(If 1 was entered run this sub-routine)
(Go to sleep for 10 minutes)
#3006= 25 (Cycle start sleeps for 10 minutes)
M95 (00:10)
GOTO100
N20
(If 2 was entered run this sub routine)
(Programmed message)
#3006= 25 (Programmed message cycle start)
GOTO100
N30
(If 3 was entered run this sub routine)
(Run sub program 20)
#3006= 25 (Cycle start program 20 will run)
G65 P20 (Call sub-program 20)
GOTO100
N40
(If 4 was entered run this sub routine)
(Run sub program 22)
#3006= 25 (Cycle start program 22 will be run)
M98 P22 (Call sub program 22)
GOTO100
N50
(If 5 was entered run this sub-routine)
(Programmed message)
#3006= 25 (Reset or cycle start will turn power off)
#1106= 1
N100
M30
%