If function, 4 f o rm ulas – HEIDENHAIN ND 2100G User Manual
Page 200

200
2 Installation and Specifications
2.4 F
o
rm
ulas
If function
The If function performs a logical true/false test and assigns a value to
a dimension or performs an operation based on the outcome of the
test. The logical test uses test criteria and conditions described earlier.
Tests can be performed on channels, dimensions, system
dimensions, custom ND 2100G functions, parallel port input pins,
database contents, time, output relay state and variables.
To insert the If function:
U
Press the OTHER... soft key
U
Press the IF dimension key
Suppressing If logical test results
When the If function is used to perform operations, the true or false
result can be suppressed by inserting a numeric zero constant in either
the true or false result position. In this example, no operation is
performed when the logical test result is false.
H1 = If(Fail(),Beep,0)
If function.
If function syntax
A = if (Logical test criterion, result when true, result when false)
Example 1: A value is assigned to a visible dimension
A = If(C1>=0.5mm,2.0,3.0)
A = 2.0 when C1 is greater than or equal to 0.5 mm
A = 3.0 when C1 is less than 0.5 mm
Example 2: An If function is appended to a dimension formula
using the semicolon function. This If function performs an
operation; it engages or disengages relay contact 1 depending on
the value of C4.
A = C4;If(C4>=5mm,Relay(1,1),Relay(1,0))
A = C4 and Relay 1 engages when C4 is greater than 5 mm
A = C4 and Relay 1 disengages when C4 is equal to or less than
5 mm
This If function could also be assigned to a hidden dimension:
H1 = If(C4>=5mm,Relay(1,1),Relay(1,0))