Page 1 of 1

Conversion FC5/6 to Flowcode 7 that contains C code

Posted: Tue Jul 05, 2016 4:50 pm
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 12209 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.

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

Posted: Sat Aug 20, 2016 11:57 pm
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

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

Posted: Tue Aug 23, 2016 11:38 am
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

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

Posted: Tue Aug 23, 2016 8:20 pm
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

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

Posted: Tue Aug 23, 2016 9:39 pm
by medelec35
Hi Ken,
Glad your all sorted.
Thanks for letting us know.

Martin