28.08.2013 Views

CNC 8035 - Programming manual - Fagor Automation

CNC 8035 - Programming manual - Fagor Automation

CNC 8035 - Programming manual - Fagor Automation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12.5 Subroutine instructions<br />

A subroutine is a part of a program which, being properly identified, can be called from any position<br />

of a program to be executed.<br />

A subroutine can be kept in the memory of the <strong>CNC</strong> as an independent part of a program and be<br />

called one or several times, from different positions of a program or different programs.<br />

Only subroutines stored in the <strong>CNC</strong>'s RAM memory can be executed. Therefore, to execute a<br />

subroutine stored in a PC connected through one of the serial lines, copy it first into the <strong>CNC</strong>'s RAM<br />

memory.<br />

If the subroutine is too large to be copied into RAM, it must be converted into a program and then<br />

the EXEC instruction must be used.<br />

(SUB integer)<br />

The SUB instruction defines as subroutine the set of program blocks programmed next until reaching<br />

the RET subroutine. The subroutine is identified with an integer which also defines the type of<br />

subroutine; either general or OEM.<br />

The OEM subroutines are treated like the general ones, but with the following restrictions:<br />

They can only be defined in OEM programs, having the [O] attribute. Otherwise, the <strong>CNC</strong> will<br />

display the corresponding error.<br />

Error 63 : Program subroutine number 1 thru 9999.<br />

To execute an OEM subroutine using CALL, PCALL or MCALL, it must be inside an OEM<br />

program. Otherwise, the <strong>CNC</strong> will display the corresponding error.<br />

Error 1255 : Subroutine restricted to an OEM program.<br />

There can not be two subroutines with the same identification number in the <strong>CNC</strong> memory, even<br />

when they belong to different programs.<br />

(RET)<br />

Range of general subroutines SUB 0000 - SUB 9999<br />

Range of OEM (manufacturer's) subroutines SUB 10000 - SUB 20000<br />

The mnemonic RET indicates that the subroutine which was defined by the mnemonic SUB, finishes<br />

in this block.<br />

( SUB 12) ; Definition of subroutine 12<br />

G91 G01 XP0 F5000<br />

ZP1<br />

XP0<br />

ZP1<br />

(RET) ; End of subroutine<br />

(CALL (expression))<br />

The mnemonic CALL makes a call to the subroutine indicated by means of a number or by means<br />

of any expression that results in a number.<br />

<strong>Programming</strong> <strong>manual</strong><br />

PROGRAM CONTROL INSTRUCTIONS<br />

Subroutine instructions 12.<br />

<strong>CNC</strong> <strong>8035</strong><br />

·T· MODEL<br />

(SOFT V16.3X)<br />

·259·

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!