3arithmetic's, 4logical expressions and operators, Arithmetic's – Lenze PMSS1000 Simple Servo User Manual

Page 28: Logical expressions and operators, 3 arithmetic's, 4 logical expressions and operators

Advertising
background image

Indexer-Programmer-Manual.pdf REV 1.3


Volatility
All Sis variables are volatile i.e. they don't maintained their values after power is removed. After power up
values of all variables are set to 0. Program load or reset doesn't change variables values.

Flags, Resolution and Accuracy
As mentioned before you can use any variable as flags in logical expressions and as conditions in
conditional expressions. Flags are often used to indicate that some event has occurred, logic state of
input has changed or that the program has executed to a particular point. Variables with non 0 value are
evaluated as "TRUE" and with 0 value as "FALSE".
Variables are stored internally as 4 bytes (double word) for integer portion and 4 bytes (double word) for
fractional portion. This way every variable in SSi system stored as 64 bit in 32.32 fixed point format.
Maximum number can be represented by this format is +/- 2,147,483,648. Variable resolution in this
format is 2.3E-10.

2.3 Arithmetic's

Four arithmetic functions are supported. Constants, User and System variables could be part of arithmetic
expressions.
Examples.

V1 = V1+V2

;Add two user variables

V1 = V1-1

;Subtract constant from variable

V2 = V1+APOS

;Add User and System (actual position) variables

APOS = 20

;Set System variable

V5 = V1*(V2+V3*5/2+1) ;Complicated expression

Operator Symbol

Addition

+

Subtraction -

Multiplication *

Division /


Result overflow for "*" and "/" operations will cause Arithmetic overflow fault # 19. Result
overflow/underflow for "+" and "-" operations does not cause arithmetic fault.

2.4 Logical expressions and operators

Bitwise, Boolean, and comparison operators are considered as Logical Operators. Simply put they are the
operators which operate on logical values of the operands. There are two possible values for logical
operand: TRUE and FALSE. Any value contained in User or System variable or flag treated as TRUE or
FALSE with these types of the operators. If variable value equal 0 it is considered FALSE. All the other
values (non 0) including negative numbers are considered TRUE.

28

Advertising