M109 Interactive User Input

Next Generation Control Mill Operator's Manual

The Online Interactive Operator's Manual is currently available in English only.

A PDF version of the Operator's Manual is available for download in multiple languages. Click the link below to view the Operator's Manual in your language. Click "Continue" to view the online version in English.

Get a translated PDF Download Continue
P - A number in the range (500-549 or 10500-10549) representing the macro variable of the same name.

M109 lets a G-code program place a short prompt (message) on the screen. You must use a P code to specify macro variable in the range 500-549 or 10500 through 10549. 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).

note: Macro Variables 540-599 and 10549-10599 are reserved for the WIPS (probe) option. If your machine is equipped with WIPS only use P500-539 or P10500-10599.

The following sample program asks the user a Yes or No question, then waits for either a Y or an N to be entered. All other characters are ignored.

% O61091 (M109 INTERACTIVE USER INPUT) ; (This program has no axis movement) ; N1 #10501= 0. (Clear the variable) ; N5 M109 P10501 (Sleep 1 min?) ; IF [ #10501 EQ 0. ] GOTO5 (Wait for a key) ; IF [ #10501 EQ 89. ] GOTO10 (Y) ; IF [ #10501 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 asks the user to select a number, then wait for a 1, 2, 3, 4 or a 5 to be entered; all other characters are ignored.

% O00065 (M109 INTERACTIVE USER INPUT 2) ; (This program has no axis movement) ; N1 #10501= 0 (Clear Variable #10501) ; (Variable #10501 will be checked) ; (Operator enters one of the following selections) N5 M109 P501 (1,2,3,4,5) ; IF [ #10501 EQ 0 ] GOTO5 ; (Wait for keyboard entry loop until entry) ; (Decimal equivalent from 49-53 represent 1-5) ; IF [ #10501 EQ 49 ] GOTO10 (1 was entered go to N10) ; IF [ #10501 EQ 50 ] GOTO20 (2 was entered go to N20) ; IF [ #10501 EQ 51 ] GOTO30 (3 was entered go to N30) ; IF [ #10501 EQ 52 ] GOTO40 (4 was entered go to N40) ; IF [ #10501 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) ; #12006= 1 ; N100 ; M30 (End Program); %
P - A number in the range (500-549) representing the macro variable of the same name.

This M code allows a G-code program to place a short prompt (message) on the screen. A macro variable in the range 500 through 549 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.

Values for ASCII Characters

32 space 59 ; semicolon
33 ! exclamation mark 60 < less than
34 " double quotation mark 61 = equals
35 # number sign 62 > greater than
36 $ dollar sign 63 ? question mark
37 % percent sign 64 @ at sign
38 & ampersand 65-90 A-Z capitol letters
39 closed single quote 91 [ open square bracket
40 ( open parenthesis 92 \ backslash
41 ) close parenthesis 93 ] closed square bracket
42 * asterisk 94 ^ carrot
43 + plus sign 95 _ underscore
44 , comma 96 open single quote
45 - minus sign 97-122 a-z lowercase letters
46 . period 123 { open curly bracket
47 / slash 124 | vertical bar
48-57 0-9 numbers 125 } closed curly bracket
58 : colon 126 ~ tilde

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

% o61091 (57 M109_01 Interactive User Input) ; 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 asks the user to select a number, then wait for a 1, 2, 3, 4 or a 5 to be entered; all other characters are ignored.

% O61092 (58 M109_02 Interactive User Input) ; 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 ; %

Be aware: Many service and repair procedures should be done only by authorized personnel. The service technicians at your Haas Factory Outlet (HFO) have the training, experience, and are certified to do these tasks safely and correctly. You should not do machine repair or service procedures unless you are qualified and knowledgeable about the processes.

Danger: Some service procedures can be dangerous or life-threatening. DO NOT attempt a procedure that you do not completely understand. Contact your Haas Factory Outlet (HFO) and schedule a service technician visit if you have any doubts about doing a procedure.

Feedback