Ever thought how useful it would be to have your machine ask the operator a question – maybe to ensure the part has been turned over, or which number is to be engraved or any number of other possibilities?
The Haas control has a function called Interactive User Input which incorporated into vers. 11.20 and released in 2002 provides the programmer with a new M code, M109 that allows a G-code program to place a short prompt on the screen, get a single character input from the user and store it in a macro variable. The first 15 characters from the comment following the M109 will be displayed as a prompt in the lower left corner of the screen.Â
A macro variable in the range 500 through 599 must be specified by a P code. Note also that due to the look-ahead feature, it is necessary to include a loop in the program following the M109 to check for a non-zero response before continuing. The program can check for any character that can be entered from the keyboard by comparing with the decimal equivalent of the ASCII character.
Here are a few common characters:
- A – 65 a – 97
- B – 66 b – 98
- C – 67 c – 99
- N – 78 n – 110
- Y – 89 y – 121
- 0 – 48 + – 43
- 1 – 49 – 45
- 2 – 50 * 42
- 3 – 51 / 47
The following sample program will ask the user a Yes/No question then wait for him to enter either a Y or an N. All other characters will be ignored.
The following sample program will ask the user to select a number then wait for him to enter a 1, 2 or a 3. All other characters will be ignored.