Using the Logic Editor
372 SPU 780 01EMAN May 2002 157
Everything to the right of the assignment operator also constitutes an expression .
An expression is any part of an equation that can be evaluated to a single value . This
can be a single constant or register address, or a complete mathematic al operation.
For example, #35 is an expression, as are LOG(#10) and 40002U + C OS(40003UL).
Complex expressions can contain other expressions within them, as in #3 * (40002 U
+ COS(40003UL)). For the most part, any operator or function can be performed on
any expression, no matter how complex.
Exponential
Notation Floating point numbers are normally specified in exponential notation, as in:
+1.34E-4
This represents 1.35 times 10 to the -4th power, or 1.35 times 0.0001. Thus, we
would shift the decimal place four places to the left to get 0.000135. The "-4" p art is
called the exponent (note the preceding "E") and can be a positive or negative
number.
In the Equation Network Editor, you must also indicate:
That these numbers are constants; and
Their data types. For example, integers or floating point numbers.
The default data type is unsigned 16-bit integer. So, since the above value is a
fraction (and therefore must be a floating point number), it would have to appear a s
#+1.35E-4F.
With no data type suffix, numbers in exponential notation are assumed to be
integers. For example, #+1.35E+2 represents the unsigned 16-bit integer value 135.
Exponential notation is particularly useful for very large integers.
Note: It is good programming practice to enclose all expressions in parentheses,
even when they’re not actually needed. This makes the equation easi er to read and
ensures that operations in an equation are solved in the correct order.