Posts Tagged ‘times’

once or many times

once or many times

This pro cess is called ‘ref er enc ing’ a vari able

Referencing Variables

Ref er encing a vari able means re plac ing the vari able num ber with the pre vi ously stored data

value For ex am ple, in copper busbar bending machine one of the ear lier ex am ples, the cut ting feedrate value was stored into the

vari able #9:

#9 = 2250

Assigns the value of 2250 to variable #9

In the pro gram, the feedrate was called as a nor mal punch machine for Head CNC word, by re fer ring the vari able to the

F-ad dress but writ ing it as F#9 A lo cal vari able not avail able as a let ter in the As sign ment List (1

or 2) can only be ref er enced in the pro gram body:

#33 = 1

Assigns the value of 1 to variable #33

In the pro gram, the new vari able can be used by it self or in an ex pres sion:

WHILE [#33 LE 6] DO1

Repeat a loop as long as condition [#33 LE 6] is true

The vari able #33 is not as so ci ated with any let ter; in the ex am copper busbar bending machine ple, it is used as a coun ter It is

used for eval u at ing the pro gram flow, in a con di tional state ment – [#33 LE 6] is the con di tion

This sub ject will be cov ered in Chap ter 13

Not all val ues have to be pos i tive Neg a tive def i ni tions and ref er ences are very im por tant in

mac ros, and many er rors are of ten caused by an in cor rect ref er enc ing Watch the dif fer ence in the

fol low ing ex am ples – the ob jec tive is to pro gram the Z-depth as Z-1275, us ing vari able data:

#26 = 1275

Assigns the positive value (1275) to variable #26

In the pro gram, the Z-depth must be pro grammed as Z-#26 The called vari able must be neg a –

tive! Can the def i ni tion it self be neg a tive? Yes, it can:

#26 = -1275

Assigns the negative value (-1275) to variable #26

In the pro gram, the Z-depth must be pro grammed as Z#26 The called vari able must be pos i –

tive!

There is a way to al ways guar an tee that the re quired value will be neg a tive, re gard less whether

the in put value is pos i tive or neg a tive It uses the macro func tion ABS – ab so lute value of a num –

ber, ex plained in the m