Computed Branch (GOTO#n and GOTO [expression])

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

Computed branching allows the program to transfer control to another line of code in the same subprogram. The control can compute the block while the program runs, using the GOTO [expression] form, or it can pass the block in through a local variable, as in the GOTO#n form.

The GOTO rounds the variable or expression result that is associated with the Computed branch. For instance, if variable #1 contains 4.49 and the program contains a GOTO#1 command, the control attempts to transfer to a block that contains N4. If #1 contains 4.5, then the control transfers to a block that contains N5.

Example: You could develop this code skeleton into a program that adds serial numbers to parts:

% O50002 (COMPUTED BRANCHING) ; (D=Decimal digit to engrave) ; ; IF [[#7 NE #0] AND [#7 GE 0] AND [#7 LE 9]] GOTO99 ; #3000=1 (Invalid digit) ; ; N99; #7=FIX[#7] (Truncate any fractional part) ; ; GOTO#7 (Now engrave the digit) ; ; N0 (Do digit zero) ; M99 ; ; N1 (Do digit one) ; ; M99 ; %

With the above subroutine, you would use this call to engrave the fifth digit:

G65 P9200 D5 ;

Computed GOTOs using expression could be used to branch processing based on the results of reading hardware inputs. For example:

% GOTO [[#1030*2]+#1031] ; NO(1030=0, 1031=0) ; ...M99 ; N1(1030=0, 1031=1) ; ...M99 ; N2(1030=1, 1031=0) ; ...M99 ; N3(1030=1, 1031=1) ; ...M99 ; %

#1030 and #1031.

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