Conditional Execution (IF THEN)

Classic 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

Execution of control statements can also be achieved by using the IF THEN construct. The format is:

IF [] THEN ;
note: To preserve compatibility with FANUC syntax THEN may not be used with GOTOn.

This format is traditionally used for conditional assignment statements such as:

IF [#590 GT 100] THEN #590=0.0 ;

Variable #590 is set to zero when the value of #590 exceeds 100.0. In the Haas control, if a conditional evaluates to FALSE (0.0), then the remainder of the IF block is ignored. This means that control statements can also be conditioned so that we could write something like:

IF [#1 NE #0] THEN G01 X#24 Y#26 F#9 ;

This executes a linear motion only if variable #1 has been assigned a value. Another example is:

IF [#1 GE 180] THEN #101=0.0 M99 ;

This says that if variable #1 (address A) is greater than or equal to 180, then set variable #101 to zero and return from the subroutine.

Here is an example of an IF statement that branches if a variable has been initialized to contain any value. Otherwise, processing continues and an alarm is generated. Remember, when an alarm is generated, program execution is halted.

% N1 IF [#9NE#0] GOTO3 (TEST FOR VALUE IN F) ; N2 #3000=11(NO FEED RATE) ; N3 (CONTINUE) ; %

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.