break
Used in looping control or select statement. It skips immediately to the end of the statement.
continue
Used in looping control statement. It quits the current iteration of a loop and starts the next one.
return
Returns to the function or module that called the current function.
Format
Examples
While [
Condition
]
[Statements]
Wend
For n = 100 Down 0 Step 3
n = n * 2
Next n
For loop = 0 To 20 Step 2
loop = (loop + 1) *2
Next loop
Boolean ex pres sions
The value of Boolean expression is zero means FALSE.
The value of Boolean expression is not zero means TRUE.
Function Calls and Passing Parameters
A sub-function must be defined before its execution and is therefore placed before the main() macro function. If
there is an entry attempt into a function before it is first defined in the macro program will create a compiler error
‘Function not defined’.
Sub int SQR(int x) //This is the sub-function that squares a
number
x = x * x
return x
End Sub
Macro_Command main( ) // This main function calls the SQR()
function.
int I = 5
I = SQR(I)
// Write the result to a LW
End Macro_Command
The above example code defines a sub-function called SQR(). This sub-function allows one variable to be passed
into it. The function then takes the value passed to it, multiplies its value by itself and then stores the result back
into the same variable. The result is returned back to the calling function.
Reading & Writing External Registers in a Macro
A macro program can communicate with external PLC data registers and I/O. The function GetData() receives data
from a PLC in the device table (or the OIT’s local LW and LB memory). The function SetData() sends data to the
PLC (or the OIT’s local LW and LB memory).
The GetData() or the SetData() can be hand typed according to the format listed below, or the “PLC API” button
located at the bottom-left of the macro editor dialog box allows the user to generate the GetData() or SetData()
function code by selecting the appropriate responses within the PLC API dialog box. Be sure to declare all variables
before using the ‘PLC API’ option. To set up the following functions, place the cursor after the declarations, and
then press the PLC API button. This way, all variables will be available in a drop-down menu list within the ‘PLC
API’ dialog.
1010-1007, Rev 05
252
Sil ver Plus Se ries In stal la tion & Op er a tion Man ual
Summary of Contents for Silver Plus Series
Page 20: ...1010 1007 Rev 05 16 Silver Plus Series Installation Operation Manual ...
Page 31: ...COM Ports for the HMI5056 5070 1010 1007 Rev 05 Connect the OIT to the PLC or Controller 27 ...
Page 38: ...1010 1007 Rev 05 34 Silver Plus Series Installation Operation Manual ...
Page 49: ...7 Click the Shape tab 1010 1007 Rev 05 Creating Your First Project 45 ...
Page 62: ...1010 1007 Rev 05 58 Silver Plus Series Installation Operation Manual ...
Page 75: ...3 Click OK The System Parameter Settings dialog appears 1010 1007 Rev 05 Using EZware 5000 71 ...
Page 132: ...1010 1007 Rev 05 128 Silver Plus Series Installation Operation Manual ...
Page 156: ...1010 1007 Rev 05 152 Silver Plus Series Installation Operation Manual ...
Page 210: ...1010 1007 Rev 05 206 Silver Plus Series Installation Operation Manual ...
Page 216: ...1010 1007 Rev 05 212 Silver Plus Series Installation Operation Manual ...
Page 246: ...1010 1007 Rev 05 242 Silver Plus Series Installation Operation Manual ...