Difference between revisions of "C Code Icon Properties"
| Line 1: | Line 1: | ||
| − | + | [[File:iconCode.png|border]] | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
The Code icon allows experienced users to add their own C or JavaScript code into their Flowcode projects. | The Code icon allows experienced users to add their own C or JavaScript code into their Flowcode projects. | ||
| Line 25: | Line 18: | ||
==Details== | ==Details== | ||
| + | {| style="margin:0px; text-align:center;" | ||
| + | |- | ||
| + | |[[File:iconCode.png|border]] | ||
| + | | width="50px" |→ | ||
| + | |[[File:Gen_C_Code_Flowchart_Icon.png]] | ||
| + | |width="50px" |→ | ||
| + | |[[File:Gen_C_Code_Icon_Properties.png]] | ||
| + | |} | ||
| + | |||
Flowcode is designed to allow those new to microcontroller programming to design programs with little knowledge of other programming languages. However it is possible to embed code written in other languages into Flowcode programs. Programs written in C and Assembly code can be embedded in Flowcode using the Code icon. This means that it is possible to take complex programs (you will find lots of programs on the internet) written in C or assembly and embed them into your designs. | Flowcode is designed to allow those new to microcontroller programming to design programs with little knowledge of other programming languages. However it is possible to embed code written in other languages into Flowcode programs. Programs written in C and Assembly code can be embedded in Flowcode using the Code icon. This means that it is possible to take complex programs (you will find lots of programs on the internet) written in C or assembly and embed them into your designs. | ||
Latest revision as of 14:59, 10 June 2026
The Code icon allows experienced users to add their own C or JavaScript code into their Flowcode projects.
Contents
Old Versions
This page is current for Flowcode v11 and later. Earlier versions can be found below:
| Flowcode v10 |
| Flowcode v9 |
| Flowcode v8 |
Details
| → | → |
Flowcode is designed to allow those new to microcontroller programming to design programs with little knowledge of other programming languages. However it is possible to embed code written in other languages into Flowcode programs. Programs written in C and Assembly code can be embedded in Flowcode using the Code icon. This means that it is possible to take complex programs (you will find lots of programs on the internet) written in C or assembly and embed them into your designs.
The code can not always be simulated by Flowcode, but is passed on to the microcontroller during compilation.
Display Name
The name of the icon that appears on the flowchart.
Variable Box
Quickly browse the variables defined in your project. You can reference ports directly or select from a list of available Global or Local variables. Dragging and dropping the variables into the C Code box will automatically add the correct Flowcode specific prefix.
Code
Enter any C code you wish to include in the flowchart. The code is not checked by Flowcode but is passed straight to the C compiler when the flowchart is compiled. It is important to verify that the code entered is correct, as syntax errors will cause the compilation of the whole flowchart to fail.
When creating a Web Developer project, the code entered into this box will be JavaScript rather than C code.
To access Flowcode global variables, local variables, macro functions and connection points, it is necessary to "colour" the variable in your C code with the prefixes FCV_, FCL_, FCM_ and FCC_MacroName_ respectively. Dragging the variable into your code will automatically add the appropriate prefix. Variables should also be written in uppercase in code.
For example, to use a global variable called "Delay" in your code, you must refer to it using "FCV_DELAY".
To call a Flowcode macro called Test in your C code, you must call FCM_Test();
Note that for Flowcode versions up to Flowcode 6, all Flowcode macro names are upper case. For Flowcode v7 and above they are case-sensitive, meaning the case of the macro names much match.
To jump to a connection point called A, defined in a Flowcode macro called TEST, the users C code must be goto FCC_TEST_A;. Connection points defined in the main flowchart of a Flowcode file are prefixed FCC_Main_.
Assembly Code
For embedded projects, assembly code can be added into the code field in a C assembly code wrapper.
For a single line of code use the asm operator in front of each instruction and use all upper case, e.g.
asm("MOVLW 0x04");
or enclose several statements within an asm block, tow methods can be used for PIC8
Either
#asm MOVLW 0x04 MOVWF TRISA #endasm
Or
asm("MOVLW 0x04");
asm("MOVWF TRISA");
Video
See the Using custom code video to see how to add code into your Flowcode projects.