Difference between revisions of "Calculation Icon Properties"
Line 1: | Line 1: | ||
− | |||
{| style="margin:auto; text-align:center;" | {| style="margin:auto; text-align:center;" | ||
|- | |- | ||
Line 12: | Line 11: | ||
− | + | ==Display Name== | |
The name of the icon that appears on the flowchart. | The name of the icon that appears on the flowchart. | ||
− | + | ==Calculations== | |
One or more lines of calculations can be entered into this box. | One or more lines of calculations can be entered into this box. | ||
Line 71: | Line 70: | ||
[[File:Gen_Calculation_Flowchart_Icon_02.png]] | [[File:Gen_Calculation_Flowchart_Icon_02.png]] | ||
− | + | ==Variable and Function Box== | |
This section is used to either select a variable or access a list of the available functions. You can reference ports directly or select from a list of available Global or Local variables. You can also view the list of available functions for [[Mathematical Functions|mathematical]] and [[String Manipulation Functions|string]] functions. | This section is used to either select a variable or access a list of the available functions. You can reference ports directly or select from a list of available Global or Local variables. You can also view the list of available functions for [[Mathematical Functions|mathematical]] and [[String Manipulation Functions|string]] functions. | ||
+ | |||
+ | |||
+ | ==IO Ports== | ||
+ | Allows you to drirectly drag a poin or port for assigning a value or wihtin calulations. | ||
+ | For example: | ||
+ | $PORTA = 10 | ||
+ | $PORTC.2 = 1 | ||
+ | $C1 = 1 | ||
+ | $PORTA.3 = $PORTB.1 | ||
+ | From Flowcode V10 With Arduino that uses different pin references the following can be used: | ||
+ | $pin3 = 1 | ||
+ | |||
+ | ==Globals== | ||
+ | Globals will allow you to create and drag global ''constants'' or [[Variable_Types|''variables'']] into the calculation window. | ||
+ | As the variables are global, they can be seen within any [[Using_the_Project_Explorer#Macros|user macro's]] | ||
+ | |||
+ | ==Locals== | ||
+ | Locals will allow you to create and drag local ''constants'' or [[Variable_Types|''variables'']] into the calculation window. | ||
+ | As the variables are ''local'', they will only be seen within the [[Using_the_Project_Explorer#Macros|user macro]] it was created in. | ||
+ | Outside the user macro, any local variables get destroyed. | ||
+ | |||
+ | ==Macros== | ||
+ | Allows you to drag any [[Using_the_Project_Explorer#Macros|''user macro'']] into the calculation icon so they can be accessed from within it. | ||
+ | |||
Revision as of 14:47, 9 March 2023
![]() |
→ | ![]() |
→ | ![]() |
Calculation icons allow the modification of variables. They can be used to check inputs and to create outputs.
Contents
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.
+, -, *, /, % - Addition, Subtraction, Multiplication, Division & Modulus.
<, <=, >, >= - Less than, Less than or equal to, Greater than, Greater than or equal to.
>>, << - Shift right, Shift left.
~, &, |, ^ - Bitwise NOT, AND, OR, Exclusive OR
NOT,AND,OR,XOR - Bitwise NOT, AND, OR, Exclusive OR
&&, ||, ! - Logical AND, OR, NOT
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.
Examples
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
$PORTA = $PORTA + 1
$pin39 = $A2
$pin2 = 1
The $ donates a pin or a port that can now be used within calculations.
If any of the variables don't exist, then Flowcode will ask if you would like to create the missing variable.
Variable and Function Box
This section is used to either select a variable or access a list of the available functions. You can reference ports directly or select from a list of available Global or Local variables. You can also view the list of available functions for mathematical and string functions.
IO Ports
Allows you to drirectly drag a poin or port for assigning a value or wihtin calulations. For example:
$PORTA = 10 $PORTC.2 = 1 $C1 = 1 $PORTA.3 = $PORTB.1
From Flowcode V10 With Arduino that uses different pin references the following can be used:
$pin3 = 1
Globals
Globals will allow you to create and drag global constants or variables into the calculation window. As the variables are global, they can be seen within any user macro's
Locals
Locals will allow you to create and drag local constants or variables into the calculation window. As the variables are local, they will only be seen within the user macro it was created in. Outside the user macro, any local variables get destroyed.
Macros
Allows you to drag any user macro into the calculation icon so they can be accessed from within it.
Video instructions
See the Calculation video to learn how to use Calculation icon correctly with valid syntax, variables and expressions.
{{#ev:youtube|eycBIVJJiLc|640}}