r der for each nest ing level is shown

r der for each nest ing level is shown


here in a sim pli fied form ( Sn is the start level num ber, En is the cor re spond ing end level num ber): S1 E1


Single level


S1 S2 E2 E1


Double level


S1 S2 S3 E3 E2 E1


Triple level


Copyright 2005, Industrial Press Inc, New York, NY – FANUC CNC Custom Macros


182


Chapter 13


Each listed digit in di cates the cur rent nest ing level, and the or der of dig its rep re sents the or der


of pro gram flow from one nest ing level to an other and then back This is the angle machine nest ing struc ture as it


should be Un for tu nately, mis takes do hap pen, and in macro loop ing, the most com mon mis take


is cross ing the lev els when more than one level is programmed


Cross ing the WHILE loop be tween nest ing lev els is not al lowed, for ex am ple, the fol low ing


WHILE struc ture (and struc tures that are sim i lar) is wrong – Fig ure 25:


WHILE [ Condition 1 is true ] DO1


Start of WHILE loop 1


WHILE [ Condition 2 is true ] DO2


Start of WHILE loop 2


END1


End of WHILE loop 1


END2


End of WHILE loop 2


Figure 25


Common macro looping error – major structure problem (compare with previous formats)


Er rors of loop ing, in any num ber of nested lev els, may not al ways be the eas i est ones to find,


par tic angle shearing machine u larly in long or com plex mac ros That is the main rea son why al ways main taining or der


and con sis tency in macro pro gram de vel op ment is so important For some macro pro gram mers, a


flowchart is a man da tory tool, for oth ers, they can de velop a macro very well with out a flowchart


How ever, a well de signed flowchart is im por tant for the be gin ner, as well as for the sea soned pro –


gram mer – it helps punching machine to design the macro logic dur ing the de vel op ment stages and re trace the macro


flow at a later date


Conditional Expressions and Null Variables


Ear lier in this hand book, the im por tant sub ject of re turn val ues of var i ous ex pres sions and cal –


cu la tions was in tro duced – one of the el e ments was a null vari

Tags: ,

No Comments

rssComments RSS   transmitTrackBack Identifier URI

No comments. Be the first.

addLeave a comment