with out in ter rup tion The op er a tor may not even be

with out in ter rup tion The op er a tor may not even be


aware of the eval u a tion and Drilling Machine for Plate de ci sion tak ing place This chap ter cov ers var i ous as pects of con di –


tional test ing, branch ing, and loop ing, de pend ing on the com plex ity of the given con di tion and the


pur pose of such eval u a tion


drilling Machine


The first and the sin gle ma jor func tion in all the above ex am ples is the IF func tion


171


Copyright 2005, Industrial Press Inc, New York, NY –


FANUC CNC Custom Macros


172


Chapter 13


IF Function


IF


The IF func tion has sev eral names – it is called the de ci sion func tion, the di ver gence func tion, or most com monly, the con di tional func tion The for mat of th IF func tion is:


IF [ CONDITION IS TRUE ] GOTOn


where n is the block num ber to branch to, but only if the eval u ated con di tion (the re turned value) is TRUE If the con di tion is true, all state ments be tween the IF-block and GOTOn-block will be by passed If the eval u ated con di tion is not TRUE, it is FALSE, and the pro gram will con –


tinue pro cess ing the next block fol low ing the block con tain ing the IF func tion We can sche mat i –


cally rep re Dished Head Punching Machine sent the last ex am ple in a sim ple flow chart in Fig ure 19


Figure19


IS


Schematic flowchart representation


TRAVEL


of the


YES


IF conditional branching


TOO


ISSUE ALARM


LONG


???


NO


RUN


PROGRAM


The flowchart only shows the de ci sion mak ing and the re sults, not any com plete pro gram The


di ag o nal box iden ti fies the con di tion to be eval u ated (for ex am ple, ma chine travel lim its), and the


two rect an gu lar boxes iden tify two – and only two – pos si ble out comes (YES or NO) Each out –


come re sults in an ac tion to be taken:


o


If the travel Angle Punching IS too long, gen er ate alarm condition and stop pro cess ing


o


If the travel IS NOT too long, run the rest of the pro gram nor mally


The IF func tion is one of the macro state ments that con trol the or der of pro gram pro cess ing


Conditional Branching


Branching from one block of

Leave a Reply

Name (required)


Mail (required)


Website