Operators - KEP MMI-1500 Installation & Operation Manual

Mmi-touchscreen series
Table of Contents

Advertisement

14.3.2 Operators

Operators are used to designate how data is to be manipulated. In each statement, the operator on the left is set to the
conditions on the right. The simplest of these is the assignment operator.
Operator
=
Arithmetic operators are used for scaling and offsetting values. The priority of arithmetic operators from highest to lowest is
as follows: multiplication and division (*, /) first then modulo division (mod) and finally addition and subtraction (+, -).
Arithmetic Operators
+
-
*
/
%
Comparison operators are used for conditional statements such as If/Then or While/Wend. The priority of comparison
operators is from left to right within the statement.
Comparison Operators
<
<=
>
>=
==
<>
Logic operators are used with the other operators to make boolean (True, False) results for conditional statements. The
priority of logic operators from highest to lowest is as follows: Not, And, Or, Xor
Logic Operators
And
Or
Xor
Not
Bitwise and Shift Operators are used to manipulate bits within char, short, and int variable types. The priority of these
operators is from left to right within the statement.
Shift Operators
<<
>>
Bitwise Operators
&
|
^
~
Note: The overall priority of all operators from highest to lowest is as follows:
Operations within parenthesis are carried out first.
Arithmetic operations
Shift and Bitwise operations
Comparison Operations
Logic Operations
Assignments
Description
Assignment Operator
Description
Addition
Subtraction
Multiplication
Division
Modulo Division (returns remainder)
Description
Less Than
Less than or Equal
Greater Than
Greater Than or Equal
Equal
Not Equal
Description
Conditional AND
Conditional OR
Conditional Exclusive Or
Conditional NOT
Description
Shift left specified number of bits
Shift right specified number of bits
ANDs two values together
ORs two values together
XORs two values together
Compliments a value
Example
preset = 77
Example
productionTotal = good + reject
weight = Ainput - tare
scaled = flow * 0.12
ratio = InA / InB
quarter = n % 3
Example
If preset < b Then preset = b
If pressure < 25 Then alarm = True
If count > total Then stop = True
While x >= 0 ...statements... Wend
If (x mod 2) == 1 Then odd = True
If adjust <> final Then error = 84
Example
If (x < b) And alarmFlag Then error = 26
If In1 OR In2 Then comp = 534
If error Xor 256 Then fault = True
While x >= 0 And Not alarm ...statements... Wend
Example
z = x << 2
MSB = timer >> 8
alarm = error & 128
load = In1 and Out4
a = a ^ b
inverse = ~value
184

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mmi-750Mmi-730Mmi-850

Table of Contents