Chapter 8. Structured Text (ST) Programming
376
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
GFK-2950C
Examples
The following code fragment assigns a value to the variable ColorVariable.
CASE ColorSelection OF
0:
ColorVariable:= Red;
1:
ColorVariable:= Yellow;
2,3,4: ColorVariable:= Green;
5..9:
ColorVariable:= Blue;
ELSE ColorVariable:= Violet;
END_CASE;
The following code fragment uses a nested CASE…OF…END_CASE construct.
CASE ColorSelection OF
0:
ColorVariable:= Red;
1:
ColorVariable:= Yellow;
2,3,4: ColorVariable:= Green;
5..9:
ColorVariable:= Blue;
ELSE
CASE ColorSelection OF
10: ColorVariable:= Violet;
ELSE ColorVariable:= Black;
END_CASE;
ColorError: 1;
END_CASE;
Summary of Contents for PACSystems RSTi-EP
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451 ...