Delta ISPSoft — 13.2.3 Conditional Structure─CASE

ISPSoft User Manual  Rules and limits  Integer expression in the figure above can be a device, a symbol, or an arithmetic expression. It can not be a constant. The data type of Integer expression must be INT (-32768~32767) or DINT (-2147483648~2147483647). If a device is used as Integer expression , the system will automatically regard the value in the device as an integer. Besides, if an arithmetic expression is used as Integer expression , and the result of the operation is not an integer, the result will be rounded down to the nearest whole digit.

 A condition value on the list can not be the same as another condition value on the list, and the condition values on the list must be integers. The range of condition values depends on the data type of Integer expression . If the data type is INT, the condition values must be in the range of -32768 to 32767. If the data type is DINT, the condition values must be in the range of -2147483648 to 2147483647.  If the sub-statements following some condition values are the same, users can combine them. (a) If the condition values are not continuous values, they are separated by commas. For example, 1, 3, 5:

Sub-statement means that the sub-statement will be executed if the value of Integer expression is 1, 3, or 5. (b) If the condition values are continuous values, the range of condition values can be indicated by the mark “ .. ”. For example, 3..6: Sub-statement means that the sub-statement will be executed if the value of Integer expression is in the range of 3 to 6 (including 3 and 6). If the mark “ .. ” is used, the value at the left side of “ .. ” must be less than the value at the right side of “ .. ”. For example, 6..3 : is an illegal range.  A sub-statement can be a legal statement, or another structure.  There is no limit on the number of sub-statements following a condition value.

 The ELSE section can be omitted. If the ELSE section is omitted, and the value of Integer expression is not on the list of condition values, no sub-statement will be executed.  After a sub-statement is executed, the execution of the program will jump out of the CASE structure. No jump instruction is needed. 13-16