Compiling a Flowchart to a Chip

From Flowcode Help
Jump to navigationJump to search

Chips can only execute code that is in hexadecimal (hex.) format. Flowcode needs to process your flowcharts (for example TEST.FCF) into a format that a chip can execute Flowcode takes a number of steps:


1) Compile Flowchart into C code

2) Compile C code into Assembler

3) Assemble the Assembler into Hex

4) Send the Hex code to the chip


Whilst this seems a bit long-winded it has the advantage that it allows you to embed third party C code or Assembly code into your programs without actually getting too bogged down in creating the code - or understanding it.


The various options available allow users to halt the process at various stages so that they can view the resulting code, or check for errors at that code level.


Before compiling your flowchart into a program that can be sent to a chip you will need to ensure you have followed the instructions in the section entitled Selecting a Target Chip.


Compile to C

Compiles the Flowchart to C code.

The resulting C file is saved in the program directory, with a .c extension, and can be viewed or used by external programs.


Select the 'Compile to C' option from the 'Build' menu (Build > Compile to C...).

Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case.

You can also use the 'Compile to C' CompileToC.png icon on the toolbar.


Compile to Hex

Compiles the Flowchart to C code and then compiles the C code to Assembly and Machine code.

The resulting ASM file is saved in the program directory, with a .asm or .s extension, and can be viewed or used by external programs.

The resulting machine code file is also saved in the program directory with a .hex, .s19 or .bin extension.


Select the 'Compile to HEX' option from the 'Build' menu (Build > Compile to HEX...).

Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case.

You can also use the 'Compile to HEX' CompileToHex.png icon on the toolbar.

If the program has already been compiled and the flowchart has not been edited then you can force a re-compilation by holding down the left shift button while clicking the 'Compile to HEX' icon on the toolbar.


Compiling to Chip

Unlike the previous two methods Compile to chip actually programs the chip after compiling the machine code file.

Compile to chip compiles the Flowchart to C code, then ASM code, then assembles the ASM to Machine code and launches the Programmer application to download the program into the chip.


Select the 'Compile to Chip' option from the 'Build' menu (Build > Compile to Chip...) to transfer the flowchart to the target microcontroller.

Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case.

You can also use the 'Compile to Chip' CompileToChip.png icon on the toolbar.


Please check your Configuration information before downloading, or if you are having problems: Many perceived errors are as a result of the incorrect set up.


Compiler errors

If the compiler detects any errors during compilation, these errors will be displayed within the Icon Lists panel.


If the program has already been successfully compiled and the flowchart has not been edited then clicking the 'Compile to Chip' Btn Compile Chip.png icon on the toolbar will skip the compilation stage and go directly to programming the device allowing multiple devices to be programmed.

You can force a re-compilation by holding down the left Shift button while clicking the 'Compile to Chip' Btn Compile Chip.png icon on the toolbar.


Compiling with non standard applications

Flowcode is optimized for use with the Microchip XC8 (PIC8), Microchip XC16 (PIC16), Microchip XC32 (PIC32) and GCC compilers (AVR, ARM). The C code generated may not be appropriate for other compilers.