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 Scheda Tecnica

Codici prodotto
198805
Pagina di 42
MATH AND BOOLEAN OPERATORS 
For Floatingpoint Operators  (Unit ADVANCED only) see Chapter FOATING POINT MODULE 
When computing terms with operators and functions the rank in hierarchy is most important. The rank is as 
follows 
 
 
RANK OPERATOR 
9 ( 
MATH FUNCTIONS  
7 NEGATIVE 
SIGN 
MULTIPLY DIVISION  MOD SHL SHR 
5 PLUS 
MINUS 
4 COMPARES 
3 NOT 
2 AND 
1 OR 
 
 
+ - / * Basic Arithmetic operations 
 
 
COMPARES 
> (larger) <(smaller) >=(larger or equal) <=(smaller or equal) =(equal) <>(not equal) 
 
Compares are legal for byte, word and constant values, as well as terms and functions 
 
 
IF MyByte1 <= MyByte2 THEN GOTO X 
IF  MyByte1*10>SQRT(MyByte2) THEN GOTO X 
 
 
 
 
SHL 
Bitwise logical shift left 
SHL (logical shift left)is legal for byte, word and constant values. The result is equal to a multiply by 2 for 
every single shift.  
  
 
MyByte1 = MyByte2 SHL 8 
Syntax: Variable = value1 SHL value2 
 
 Variable: Variable of Byte oder Word type  
 value1 Variable, value oder constant of Byte oder Word type  
 value2 Variable, value oder constant of Byte oder Word type 
 
 
SHR 
Bitwise logical shift right 
SHL (logical shift right) is legal for byte, word and constant values. The result is equal to a division by 2 for 
every single shift. 
  
 
MyByte1 = MyByte2 SHR 8 
Syntax: Variable = value1 SHR value2 
 
 Variable: Variable of Byte oder Word type  
 value1 Variable, value oder constant of Byte oder Word type  
 value2 Variable, value oder constant of Byte oder Word type 
AND, OR XOR NOT 
Are boolean operators used for bitwise manipulation of variables or constants.  
 
18