C Control The I Unit-M Advanced 5 Vdc Inputs / outputs 16 x digital I/Os / 8 x analogue or digital I/Os Program memory 2 198805 データシート
製品コード
198805
SELECT CASE statements can be nested. Each nested SELECT CASE statement must have a matching
END SELECT statement.
Select Case matchexpression
END SELECT statement.
Select Case matchexpression
[Case expression]
[instructions]
[Case Else expression]
[Case Else expression]
[elseinstructions]
SELECT CASE i
CASE 1
PRINT "1"
CASE 2
PRINT "2"
CASE ELSE
PRINT "No Match"
END SELECT
End Select
WAIT
The Wait instructionis used as level-sensitive control.
The processor waits when the expressions is False. When the expression is True, the statement is executed.
The expression (or it's result) is treated as boolean value, therefore wait responds to True and False only
WAIT
The Wait instructionis used as level-sensitive control.
The processor waits when the expressions is False. When the expression is True, the statement is executed.
The expression (or it's result) is treated as boolean value, therefore wait responds to True and False only
WAIT (Mybitport = ON)
Syntax: WAIT [expression]
Because a bitport is always boolean
WAIT (MyBitPort)
it may be written:
GOTO
The GOTO Instruction causes a jump to a label in source code. No return address is saved
GOTO
The GOTO Instruction causes a jump to a label in source code. No return address is saved
MyLabel: IF (MyBitPort=OFF THEN GOTO MyLabel
Syntax: GOTO Label
The example is equal in functionas: WAIT MyBitPort.
FUNCTION
The Function keyword initialises a new function. A function may request parameter when it is called. To save
memory you may use the REF keyword to create a reference for variables i.e. the parameters passed to the
functions occupies the same bytes of memory as the reference. Using this reference variables you may save
a lot of memory because always only the set of reference variables is used for passing the parameters to a
function. You may also return a value when the function is exited.
Syntax: Function [Name] ([[Parameter] As [Data type] | [Parameter] Ref [Variable], ...])
[instructions]
Return [expression]
The example is equal in functionas: WAIT MyBitPort.
FUNCTION
The Function keyword initialises a new function. A function may request parameter when it is called. To save
memory you may use the REF keyword to create a reference for variables i.e. the parameters passed to the
functions occupies the same bytes of memory as the reference. Using this reference variables you may save
a lot of memory because always only the set of reference variables is used for passing the parameters to a
function. You may also return a value when the function is exited.
Syntax: Function [Name] ([[Parameter] As [Data type] | [Parameter] Ref [Variable], ...])
[instructions]
Return [expression]
FUNCTION MyFunction(X as byte Y as byte)
X=2*Y
RETURN 2*X
END FUNCTION
-----------------------------------------------------------
PRINT MyFunction(1,2)
End Function
Name: Valid identifier
Parameter: Optional. Valid variable identifier
Data type: Required if parameter variable is not a REF Type variable .
Variable: Required if parameter variable is a REF Type variable Identifier of a declared variable.
Name: Valid identifier
Parameter: Optional. Valid variable identifier
Data type: Required if parameter variable is not a REF Type variable .
Variable: Required if parameter variable is a REF Type variable Identifier of a declared variable.
21