both values must be true for the whole state ment to be true On the other hand, if a


given is com pared with a given , and used with the OR func tion, only one value of the state ment must be true for the whole state ment to be true In ei ther case, a TRUE


value re turns 1, and a FALSE value re turns 0


Boolean and Bi nary Examples


As an ex er cise, eval u ate the fol low ing macro data en tries The first group is the given data, the


sec ond group is the eval u ated data, and the fi nal third group is the com pared data


2 Given data :


#1 = 1000


Stored value is 1000


#2 = #0


No data – variable is VACANT (empty, null)


#3 = 1000


cnc drilling Machine


Stored value is 1000


#4 = 1500


Stored value is 1500


2 Evaluated data :


#5 = [#1 EQ #2]


Returns 0 = FALSE


#6 = [#2 EQ #3]


Returns 0 = FALSE


#7 = [#2 EQ #0]


Returns 1 = TRUE


#8 = [#1 EQ #3]


Returns 1 = TRUE


#9 = [#4 GT #3]


Returns copper busbar bending machine 1 = TRUE


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


FANUC CNC Custom Macros


126


Chapter 9


2 Compared data :


#10 = [[#1 EQ #3] AND [#2 EQ #0]]


TRUE


because both values are true


#11 = [[#1 EQ #3] OR [#2 EQ #0]]


TRUE


because both values are true


#12 = [[#1 NE #4] OR [#4 LT #3]]


TRUE


because at least one value is true


#13 = [[#2 EQ #1] AND [#3 GT #4]]


FALSE


because neither value is true


#14 = [[#3 NE #0] OR [#1 EQ #2]]]


FALSE


because only one value is true


In all pre vi ous ex am ples, the cor rect use of the brack ets [] in the macro is very im por tant If


the eval u ated con di tions are more com plex, for ex am ple in a multi-depth nest Busway Press Clamp Machine ing ap pli ca tion, the


brack ets will be nested as well, up to so many lev els that the macro pro gram will even tu ally be –


come dif fi cult to in ter pret The so best mill drill lu tion to this prob lem is to avoid ex ces sive nest ing, and use


multi-block def i ni tions in stead


Conversion Functions


Spe cial con ver sions in a macro pro gram can be used for sig nal ex change to PMC and from


PMC (PMC is the ab bre vi a tion of Pro gram