Chapter
2
Reference Manual
IVC-2D
22
©
SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Getting Started
In range
, which tests if a value lies within a range specified by the upper and lower limit
of the range, and returns 1 if the value is within the range or 0 if it is not within the ran-
ge.
If then goto
, which jumps to a specified program step if a value is not zero.
The Distance and angle tool returns an angle between 0 and 360 degrees, but we would
like to specify an angle between for example -5 to +5 degrees as being a valid angle. One
way to get around this is to state that angles between 5 and 355 degrees are not accep-
ted, and any other angle is accepted.
α
90°
180°
270°
0°
α
90°
180°
270°
0°
Angle Out of Range
Angle In Range
• Angle of the label is OK
• The test if the angle is
within “Out of Range”
returns 0, and no jump is
made
• Angle is not OK
• The test if the angle is
within “Out of Range” re-
turns 1, and the program
jumps
To make it even more flexible, we will store the highest angle that is accepted in the table,
and calculate the range directly in the program step.
36.
Add an
In range
tool (from the
Calculation
toolbar).
37.
Set the parameter
01=Value
to the angle that was calculated by the previous step by
referring to the result of that step.
38.
Enter the highest acceptable angle, for example 5 degrees, in a row in the table.
39.
Set the parameter
02=Min value allowed
to refer to the table row in which the angle is
stored.
40.
Set the parameter
03=Max value allowed
to the following value:
=360-V<table row>
where
<table row>
is replaced with the number of the row where the angle is
stored.
41.
Add an
If then goto
tool (from the
Program
toolbar).
42.
Set the parameter
01=Control expression
to the result of the
In range
step.
Do not set the parameter
02=Goto step
yet, since we are going to jump to a program
step that we have not added to the program.