Conversion FC5/6 to Flowcode 7 that contains C code

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Conversion FC5/6 to Flowcode 7 that contains C code

Post by medelec35 »

Before compiling Flowcode V7 that has been loaded with Flowchart from Flowcode V5 or Flowcode V6 you must convert C code from BoostC to XC8 as that is what's shipped with Flowcode V7
In Boost C lower case is used for register and uppercase for bits.
In XC8 Upper case is used for both.
Examples

Code: Select all

BoostC  (Up to FC6)         XC (FC7)
osccon = 0x70;              OSCCON = 0x70;
st_bit(iocap,IOCAP3);     st_bit(IOCAP,IOCAP3); or set_bit(IOCAP,IOCAP3);
If bit is a NOT bit, for example to enable weak pullups the register bit could have a bar above:
Option Register.jpg
Option Register.jpg (8.01 KiB) Viewed 11104 times
Then you need to place a lower case n preceding the bit name.
for example to enable weak pull-ups on 16F1825 you will need to use:

Code: Select all

clear_bit(OPTION_REG,nWPUEN); or  cr_bit(OPTION_REG,nWPUEN);
If I find any more examples I will post them.
Martin

millsk3
Posts: 2
Joined: Sat Aug 20, 2016 11:41 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Conversion FC5/6 to Flowcode 7 that contains C code

Post by millsk3 »

I am learning how to use Flowcode 7 using the book: Create 30 PIC Microcontroller Projects with Flowcode 6. Most of the projects work without problems and the only ones that don't work are those with C Code.
I have no knowledge of C Code, so could someone help me to convert the C Code so it works in Flowcode 7. The one I am looking at is : FCV_FROMTABLE = ATF [FCV_POSITIONINTABLE] ;
It would be good if Matrix could provide a list of examples for the commonly used C Code or even an update of the files which support this book.
Thank you.
Regards
Ken

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Conversion FC5/6 to Flowcode 7 that contains C code

Post by medelec35 »

Hi Ken,
It looks like the formation of a lookup table in C since FCV is just FlowCode Variable.
So it was just retreving a value from an array.
That's what the square brackets mean - [] = array

Since from Flowcode V6 there is a lookup table component you can use that instead of C code.
For help on lookup table component see here
Just to make sure if you post your flowchart I can take a look.

Martin
Martin

millsk3
Posts: 2
Joined: Sat Aug 20, 2016 11:41 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Conversion FC5/6 to Flowcode 7 that contains C code

Post by millsk3 »

Martin,

Thank you very much. I have substituted the lookup table as you suggested and it now works properly, this also allows me to use the simulation function.

Ken

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Conversion FC5/6 to Flowcode 7 that contains C code

Post by medelec35 »

Hi Ken,
Glad your all sorted.
Thanks for letting us know.

Martin
Martin

Post Reply