Haas M109 交互式用户输入 – Haas Mill
Haas M109 交互式用户输入
M109 M 代码允许 G 代码程序在屏幕上放置一个简短的提示(消息)。 500 到 599 范围内的宏变量必须由 P 代码指定。该程序可以通过与 ASCII 字符的十进制等效值进行比较来检查可以从键盘输入的任何字符(G47,文本雕刻,有一个 ASCII 字符列表)。
如何清除 Haas 机床上的所有偏移
M109 示例程序
以下示例程序将询问用户是或否的问题,然后等待输入“Y”或“N”。所有其他字符将被忽略。
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
下面的示例程序将要求用户选择一个数字,然后等待输入 1、2、3、4 或 5;所有其他字符将被忽略。
% 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 %
数控机床