Flowcode4 : an another problem with custom component

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Alain Bideberry
Posts: 7
Joined: Sun Dec 30, 2012 9:49 am
Has thanked: 3 times
Been thanked: 2 times
Contact:

Flowcode4 : an another problem with custom component

Post by Alain Bideberry »

Hi,

I'm trying to build an HMI on a MikroMedia Board For PIC18FJ from Mikroelectronika.
In this board I use a TFT graphical LCD and the touch plane.
As it's something for my students, I use Flowcode to develop the final software.

Before this step, I've verified all graphical and touch plane basic functions in a project compiled with Microchip C18 (v3.40) C compiler.
I draw circles, rectangles, texts. In contact with the touch plane, I can find the X-Y coordonates and display them. All right !

I'd like that my students do the same things but more simply by using the custom component and its functions I've developped.

Now I'have to translate in Flowcode C language (special version of BoostC compiler).

This preparation needs to update the PIC_custom.c files with the correct code.
Then in a Flowcode file, I compile the code in C (In french Puce : Compiler --> Hex) Then I load the .hex file in the board with Microchip ICD2 programmer.
I don't simulate anything.

1/Project FlowcodeValidTFT : With just graphical functions (tft_* functions), there's no problem. The compilation goes right and I can program the board.
The program runs well. I'd tried to send the zipped file but it's too big !

2/Project TstTactile : when I add touch plane functions (tact_* functions) to graphical functions in PIC_Custom.c file, the compilation fails with
a lot of error messages.
The problem is in 909:8 line of TstTactile.c file. The compilator can't change the name of "tact_anX" function in "FCD_Custom0_tact_anX" as required
by Flowcode compiler.

After searching in C code, I don't understand this result !!! Has somebody an idea for the solution ? Thanks.




I put in TstTactile.zip, all files to see the problem. Copy the PIC_Custom TFT TACT.c in Flowcode Components directory and rename it in PIC_Custom.c.
Attachments
TstTactile.zip
(76.15 KiB) Downloaded 293 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Flowcode4 : an another problem with custom component

Post by kersing »

Flowcode will not do this translation for you as far as I know. You need to change the C code to call the correct routines yourself. As there is only one instance of the component allowed (MultipleAllowed=0) the name is always the same (Prefix the existing calls with FCD_Custom0_ and the code compiles without an issue).

BTW, You need to add a couple of entries to the MacroIsPrivate definitions.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Flowcode4 : an another problem with custom component

Post by JonnyW »

Hello. To add to this, I have not seen your sample but believe Flowcode has a limit of 32 functions per custom-component.

I seem to remember hitting this limit on a project a while ago and vaguely remember the result was just some unrecognised functions in C - so just a load of C errors on compile.

This might be the reason. If you have lots of functions you can always add them to supplementary code and call direct from C icons. You can even keep them in a separate file and just #include the file in supplementary code.

Cheers,

Jonny

User avatar
Dan81
Valued Contributor
Valued Contributor
Posts: 268
Joined: Sun Jan 15, 2006 4:07 pm
Location: Albi France
Been thanked: 60 times
Contact:

Re: Flowcode4 : an another problem with custom component

Post by Dan81 »

Bonjour Alain

Ouvre ton fichier PIC_custom.c"

1- Comme le dit Kersing :
ligne 1215 : remplace : "x_an0=tact_anX()" par "x_an0=FCD_Custom0_tact_anX()
et 1216 : idem
Je ne sais pas pourquoi cela ne se rajoute pas automatiquement !!

2- lignes 141 à 143 ;
Remplace "unsigned int" par "short"
Lors de l'edition de la macro cela permet de voir qu'il faut un "INT" pour la valeur de retour (precedemment il y avait "NONE")

La compilation est OK, mais cela donne-t-il le bon resultat ?

Daniel

Post Reply