Difference between revisions of "C Code Icon Properties"

From Flowcode Help
Jump to navigationJump to search
Tags: Flowcode v8 Version
(updated for v11)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<sidebar>Sidebar: Icon Properties</sidebar>
+
 
 
{| style="margin:auto; text-align:center;"
 
{| style="margin:auto; text-align:center;"
 
|-
 
|-
Line 7: Line 7:
 
|width="50px" |&rarr;  
 
|width="50px" |&rarr;  
 
|[[File:Gen_C_Code_Icon_Properties.png]]
 
|[[File:Gen_C_Code_Icon_Properties.png]]
 +
|}
 +
<br>
 +
==Old Versions==
 +
This page is current for Flowcode v11 and later. Earlier versions can be found below:
 +
{| class="wikitable"
 +
|+
 +
|-
 +
| [[Special:PermanentLink/38600|Flowcode v10]]
 +
|-
 +
| [[Special:PermanentLink/38600|Flowcode v9]]
 +
|-
 +
| [[Special:PermanentLink/15269|Flowcode v8]]
 
|}
 
|}
  
 +
<br>
 +
==Introduction==
 
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.
  
  
The code can not be simulated by Flowcode, but is passed on to the microcontroller during compilation.
+
The code can not always be simulated by Flowcode, but is passed on to the microcontroller during compilation.
  
  
Line 25: Line 39:
  
  
'''C Code'''
+
'''Code'''
  
Enter any C code you wish to include in the flowchart. The C 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 C code entered is correct, as syntax errors will cause the compilation of the whole flowchart to fail.  
+
Enter any C code you wish to include in the flowchart. The C 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 C code entered is correct, as syntax errors will cause the compilation of the whole flowchart to fail.
  
  
To access Flowcode variables, macro functions and connection points, it is necessary to color the variable in your C code with the prefixes FCV_, FCM_ and FCC_MacroName_ respectively.
+
When creating a Web Developer project, the code entered into this box will be JavaScript rather than C code.
 +
 
 +
 
 +
To access Flowcode variables, macro functions and connection points, it is necessary to "colour" the variable in your C code with the prefixes FCV_, FCM_ and FCC_MacroName_ respectively.  Dragging the variable into your code will automatically add the appropriate prefix.
  
  
Line 38: Line 55:
  
  
To call a Flowcode macro called TEST in your C code, you must call FCM_TEST();
+
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.
 
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_.
 
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_.
Line 48: Line 65:
 
'''Assembly Code'''
 
'''Assembly Code'''
  
Assembly code can be added into the code field in a C assembly code wrapper.
+
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, e.g.
+
For a single line of code use the asm operator in front of each instruction and use all upper case, e.g.
  
  asm movlw 5
+
  asm("MOVLW 0x04");
  
  
or enclose several statements within an asm block:
+
or enclose several statements within an asm block, tow methods can be used for PIC8
 +
Either
 +
#asm
 +
MOVLW 0x04
 +
MOVWF TRISA
 +
#endasm''
  
  asmTo access Flowcode variables, macro functions and connection points, it is necessary to further color the prefixes used above with a preceding underscore, _FCV_, _FCM_ and _FCC_MacroName_ respectively.
+
Or
 
+
  asm("MOVLW 0x04");
 
+
asm("MOVWF TRISA");
The examples used above now become _FCV_DELAY, _FCM_TEST() and _FCC_TEST_A.
 
  
  
Line 67: Line 88:
  
 
See the [http://www.youtube.com/watch?v=JgjQlV6LQYI&list=PLQDWBb7bxuCgg6aJgPJcfXBMzZdLILceQ Custom code] video to learn how to add custom C code to the flowchart using the C Code icon to set the value of a variable to 0.
 
See the [http://www.youtube.com/watch?v=JgjQlV6LQYI&list=PLQDWBb7bxuCgg6aJgPJcfXBMzZdLILceQ Custom code] video to learn how to add custom C code to the flowchart using the C Code icon to set the value of a variable to 0.
 
<div align="center">
 
{{#ev:youtube|JgjQlV6LQYI|640}}
 
</div>
 

Latest revision as of 14:52, 24 October 2025

Btn C Code.gif Gen C Code Flowchart Icon.png Gen C Code Icon Properties.png


Old Versions

This page is current for Flowcode v11 and later. Earlier versions can be found below:

Flowcode v10
Flowcode v9
Flowcode v8


Introduction

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 C 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 C 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 variables, macro functions and connection points, it is necessary to "colour" the variable in your C code with the prefixes FCV_, FCM_ and FCC_MacroName_ respectively. Dragging the variable into your code will automatically add the appropriate prefix.


For example, to use a Flowcode variable called DELAY in your C code, you must refer to it using FCV_DELAY

Note that all Flowcode defined variables are upper case.


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 instructions

See the Custom code video to learn how to add custom C code to the flowchart using the C Code icon to set the value of a variable to 0.