Calculation icon properties
Calculation icons allow the modification of variables. They can be used to check inputs and to create outputs.
Display Name
The name of the icon that appears on the flowchart.
Calculations
One or more lines of calculations can be entered into this box
All calculations must consist of the name of an existing variable, and equals sign and an expression made up from numbers, variables and the following operators:
( ) - Parentheses.
= <> -Equal to, Not equal to.
+ - * / MOD - Addition, Subtraction, Multiplication, Division & Modulus.
< <= > >= - Less than, Less than or equal to, Greater than, Greater than or equal to.
>> << - Shift right, Shift left.
NOT AND OR XOR - NOT(inversion), AND, OR, Exclusive OR
Numeric values can be in decimal (unmarked) or in HEX format (preceded by 0x) or in Binary format (preceded by 0b) e.g. 85 or 0x55 or 0b01010101.
Assuming that the variables have been previously defined, all the following are valid calculation lines.
DELAY = DELAY + 1
DELAY = (MYVAR + 3) * 3
NEXTBIT = LASTBIT >> 2 & MASK
AANDB = PORT_A AND PORT_B
INVX = NOT X
Browse for variable button
This button brings up the variables dialog window allowing you to select an existing variable or to create a new one.
See the Creating variables page for more information on variables.
Functions (Flowcode PIC only)
Flowcode includes an additional set of mathematical functions:
float = fadd(float, float) - Add two floating point numbers together
float = fsub(float, float) - Subtract two floating point numbers
float = fmul(float, float) - Multiply two floating point numbers
float = fdiv(float, float) - Divide two floating point numbers
float = fmod(float, float) - MOD function for floating point numbers
byte = isinf(float) - Checks to see if the floating point number is infinite
byte = isnan(float) - Checks to see if the floating point is not a number
byte = float_eq(float, float) - Compares two floating point numbers to see if they are equal
byte = float_ge(float, float) - Compares two floating point numbers to see if they are greater then or equal
byte = float_gt(float, float) - Compares two floating point numbers to see if they are greater then
byte = float_le(float, float) - Compares two floating point numbers to see if they are less then or equal
byte = float_lt(float, float) - Compares two floating point numbers to see if they are less then
int = random() - Generates a random number -32768 <=> 32767
Functions (Flowcode AVR only)
Flowcode includes an additional set of mathematical functions:
fabs( x ), floor( x ), ceil( x ) - absolute value, floor and ceiling functions
fmod( x , y ) - floating point modulus (remainder of x divided by y)
sqrt( x ), cbrt( x ) - square and cube roots
log( x ), log10( x ) - logarithms (base e and base 10)
exp( x ), pow( x , y ) - exponential and power functions (x to the power of y)
sin( x ), cos( x ), tan( x ) - trigonometric functions
asin( x ), acos( x ), atan( x ), - inverse trigonometric functions
atan2( y , x ) - four-quadrant inverse tangent
sinh( x ), cosh( x ), tanh( x ) - hyperbolic functions
isnan( x ), isinf( x ) - tests for not-a-number and infinity
Functions (Flowcode ARM only)
Flowcode includes an additional set of mathematical functions:
fabs( x ), floor( x ), ceil( x ) - absolute value, floor and ceiling functions
round( x ) - decimal rounding (x rounded to the nearest integer)
fround( x , y ) - floating point rounding (x rounded to y decimal places)
fmod( x , y ) - floating point modulus (remainder of x divided by y)
sqrt( x ), cbrt( x ) - square and cube roots
log( x ), log10( x ) - logarithms (base e and base 10)
exp( x ), pow( x , y ) - exponential and power functions (x to the power of y)
sin( x ), cos( x ), tan( x ) - trigonometric functions
asin( x ), acos( x ), atan( x ), - inverse trigonometric functions
atan2( y , x ) - four-quadrant inverse tangent
sinh( x ), cosh( x ), tanh( x ) - hyperbolic functions
asinh( x ), acosh( x ), atanh( x ) - inverse hyperbolic functions
fact( x ) - factorial
random( ) - random number between 0 and 32767
isnan( x ), isinf( x ) - tests for not-a-number and infinity