software is in tentionally designed to cover more than necessary in every day work

software is in tentionally designed to cover more than necessary in every day work


This last type of a loop struc ture con trols three events si mul ta neously – again, in dents show the


programming structure – Figure 24:


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


BRANCHES AND LOOPS


181


WHILE [ Condition 1 is true ] DO1


drilling Machine


Start of WHILE loop 1


< Body of Loop 1 – Part 1 >


WHILE [ Condition 2 is true ] DO2


Start of WHILE loop 2


< Body of Loop 2 – Part 1 >


WHILE [ Condition 3 is true ] DO3


Start of WHILE loop 3


< Body of Loop 3 >


END3


End of WHILE loop 3


< Body of Loop 2 – Part 2 >


END2


End of WHILE loop 2


< Body of Loop 1 – Part 2 >


END1


End of WHILE loop 3


Figure 24


Triple level of macro looping – controls three events at the time


General Considerations


From the sev eral ex am ples of the WHILE func tion struc ture, its proper us age should be come


much clearer When the in the WHILE state ment is sat is fied (that means it is true), the blocks be tween the DOn and the cor notching machine re spond ing ENDn are ex automatic punching machine e cuted re peat edly, in the or der in


which they are pro grammed Each new pass through the loop al ways eval u ates the given con di tion


again and again When the con di tion fails, that means it is not true any more – it is false, then the


macro flow of the loop is trans ferred to the block im me di ately fol low ing the ENDn state ment In


some rare cases, the DOn and ENDn can also be used with out the WHILE state ment, but this is def –


i nitely not a rec om mended prac tice or pro fes sional ap proach to programming


Restrictions of the WHILE Loop


From the pre vi ous ex am ples of a macro loop struc ture, a very de fin i tive pat tern CNC Angle Line emerges in the


struc tural nest ing of the WHILE func tion The DOn and the ENDn must al ways be pro grammed in


pairs, work ing from the in ner most loop out wards De pend ing on the nest ing level (1, 2, or 3), the


cor rect macro pro gram must fol low the pat tern or der The o

Tags: ,

Leave a Reply