Creating and Running Algorithms 209Chapter 6
Comparison Operators == (is equal to) examples; a == b
!= (is not equal to) a != b
< (is less than) a < b
> (is greater than) a > b
<= (is less than or equal to) a <= b
>= (is greater than or equal to) a >= b
Logical Operators || (or) examples; (a == b) || (a == c)
&& (and) (a == b) && (a == c)
Unary Logical Operator ! (not) example; !b
The result of a comparison operation is a boolean value. It is still a type float
but its value is either 0 (zero) if false or 1 (one) if true. Any variable may be
tested with the if statement. A value of zero tests false, if any other value, it
tests true. For example:
/* if my_var is other than 0, increment count_var */
if(my_var) count_var=count_var+1;
Intrinsic Functionsand Statements
The following functions and statements are provided in the VT1422A's
Algorithm Language:
Functions:
abs(expression) return absolute value of expression
max(expression1,expression2) return largest of the two expressions
min(expression1,expression2) return smallest of the two expressions
Statements:
interrupt() sets bit 11 of STAT:OPER register
writeboth(expression,cvt_loc)write expression result to FIFO
and CVT element specified.
writecvt(expression,cvt_loc)write expression result to CVT
element specified.
writefifo(expression)write expression result to FIFO.
Note The sum of the number of calls to writefifo(), writecvt() and writeboth()
must not exceed 512.