beautypg.com

Variable and global functions, Variables, 4 f o rm ulas – HEIDENHAIN ND 2100G User Manual

Page 240

background image

240

2 Installation and Specifications

2.4 F

o

rm

ulas

Variable and Global functions

Variables and Globals are used to:

„

Assign values to dimensions

„

Create loops or event counters to control the flow of logic

Variables

Variables are local to parts. For example, a variable used in part 0 will
not be available in Part 1. Up to 20 variables can be used in each part.

To insert the Variable function:

U

Press the OTHER... soft key

U

Press the XTRA dimension key

U

Use the arrow cursor keys to highlight Var

U

Press the ENTER key

U

Use the numeric keypad to enter the variable id

U

Press the ENTER key

Setting the value of a variable

The method of setting the value of a variable depends on the
application.

Reading the value of a variable

Variables can be tested by If and Case functions to count loop
executions, indicate states and assign values to dimensions.

Var function.

Syntax for setting the value of a variable

Var#(Value)

Examples:

Var1(ask!"Number")

The value is entered by the user in response to a prompt.

Var1(C1+sqr(C2+C3))

The value is calculated from the expression in parentheses.

Var1(27)

The value is set directly to the constant 27.

Syntax for reading the value of a variable

Var#( )

Example: