CHAPTER 4 – CX-Supervisor Script Language
OMRON
Page 20
Revision 2.0
Typical Examples
SELECT CASE colourvalue
CASE 1
colour (blue)
CASE 2
colour (green)
CASE 3
colour (cyan)
CASE ELSE
colour (0)
END SELECT
This example shows the assignment of a colour according to the value of a point. The value of
Integer point ‘colourvalue’ is evaluated and compared with each case until a match is found. When a
match is found, the sequence of actions associated with the CASE statement is performed. When
‘colourvalue’ is 1, the colour given to the current object is blue, when ‘colourvalue’ is 2, the colour
given to the current object is green, when ‘colourvalue’ is 3, the colour given to the current object is
cyan. If ‘colourvalue’ falls outside the integer range 1—3, then the colour given is 0 (black). Like
ELSE and ELSEIF, the CASE ELSE statement is optional.
SELECT CASE TRUE
CASE temperature > 0 AND temperature <= 10
colour (blue)
CASE temperature > 10 AND temperature <= 20
colour (green)
CASE temperature > 20 AND temperature <= 30
colour (red)
CASE ELSE
colour (white)
ENDSELECT
In this example, instead of using a point as the condition as with the previous example, the value is
the condition — in this case Boolean state ‘‘TRUE’’ — with the integer point ‘temperature’ being
tested at each case. If it is ‘‘TRUE’’ that ‘temperature’ is between 0 and 10, then the current object is
set to blue, or if it is ‘‘TRUE’’ that ‘temperature’ is between 11 and 20, then the current object is set
to green, or if it is ‘‘TRUE’’ that ‘temperature’ is between 21 and 30, then the current object is set to
red. If none of these CASE statements are met, then the current object is set to white. Like ELSE
and ELSEIF, the CASE ELSE statement is optional.
References
Refer to chapter 6, Object Commands
for details of applying attributes to an object and for the use of
the Colour object command. Refer to chapter 8, Colour Palette
for details of the Colour Palette
colour designation.
Содержание CX-SUPERVISOR - SCRIPT REFERENCE REV2.0
Страница 2: ...CX Supervisor Script Language Software Revision 2 0...
Страница 3: ......
Страница 5: ...CX Supervisor Script Language OMRON Page ii Revision 2 0...
Страница 7: ...CX Supervisor Script Language OMRON Page iv Revision 2 0...
Страница 9: ...CX Supervisor Script Language OMRON Page vi Revision 2 0...
Страница 13: ......
Страница 15: ...CHAPTER 1 Introduction OMRON Page 2 Revision 2 0...
Страница 19: ...CHAPTER 2 Expressions OMRON Page 6 Revision 2 0...
Страница 21: ...CHAPTER 3 Scripts OMRON Page 8 Revision 2 0...
Страница 151: ...CHAPTER 8 Colour Palette OMRON Page 138 Revision 2 0...