Conditional Branch (IF and M99 Pnnnn)

Classic Control - Lathe 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

Conditional branching allows the program to transfer control to another section of code within the same subroutine. Conditional branching can only be used when macros are enabled. The Haas control allows two similar methods for accomplishing conditional branching:

IF [<conditional expression>] GOTOn

As discussed, is any expression that uses any of the six Boolean operators EQ, NE, GT, LT, GE, or LE. The brackets surrounding the expression are mandatory. In the Haas control, it is not necessary to include these operators. For example:

IF [#1 NE 0.0] GOTO5 ;

could also be:

IF [#1] GOTO5 ;

In this statement, if the variable #1 contains anything but 0.0, or the undefined value #0, then branching to block 5 occurs; otherwise, the next block is executed.

In the Haas control, a <conditional expression>  is also used with the M99 Pnnnn format. For example:

G00 X0 Y0 [#1EQ#2] M99 P5;

Here, the conditional is for the M99 portion of the statement only. The machine tool is instructed to go to X0, Y0 whether or not the expression evaluates to True or False. Only the branch, M99, is executed based on the value of the expression. It is recommended that the IF GOTO version be used if portability is desired.

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