Page 1 of 2
Using 2 Costum Code Blocks !!Help!!
Posted: Thu May 09, 2013 10:45 pm
by Jordy101091
HI all,
I want to use two of the same costum code blocks.
The point is I want to control two graphic displays with one microcontroller (KS0108)
I'm using the costum component from the side and I have renamed them accordingly.
When I try to compile it gives me this error:
File name: \\NASHJJAKL\Jordy Kleian\Documenten\Flowcode Projects\Projecten\Power Supply Rev.2\uC Display\Display.c
Title:
Description:
Generated by: Flowcode v5.5.2.1
Date: Thursday, May 09, 2013 23:43:52
Licence: Professional
Registered to: Jordy Kleian
Licence key: H8NNFC
http://www.matrixmultimedia.com
De compiler wordt gestart...
C:\Program Files (x86)\Flowcode\v5\Tools\boostc\boostc_pic18_flowcode.exe -v -t PIC18F6722 "Display.c"
BoostC Optimizing C Compiler Version 7.04 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday
Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited
Display.c
Starting preprocessor: C:\PROGRA~2\Flowcode\v5\Tools\boostc\pp.exe Display.c -i C:\PROGRA~2\Flowcode\v5\Tools\boostc\include -d _PIC18F6722 -la -c2 -o Display.pp -v -d _BOOSTC -d _PIC18 -d _CHAR_INDEX
Display.c(942): Illegal redefinition of symbol: MX_DATA_PORT
Display.c(943): Illegal redefinition of symbol: MX_DATA_TRIS
Display.c(944): Illegal redefinition of symbol: MX_CONTROL_PORT
Display.c(945): Illegal redefinition of symbol: MX_CONTROL_TRIS
4 errors detected
Error: preprocessing error
failure
......Resultaat = 1
Flowcode kan de C-code niet vertalen vanwege de volgende fout:
Als de flowchart C-code bevat, controleer die dan zorgvuldig. Als de flowchart geen C-code bevat of als die gegarandeerd vrij is van fouten, neem dan contact op met de technische ondersteuning.
KLAAR
What is the problem here and how can I fix this.
If anyone can help me, I would really appreciate it.
Regards Jordy
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Thu May 09, 2013 10:52 pm
by JonnyW
Hi.
I haven't had a chance to look at your code, but the issue is that you are defining the same symbols twice.
Adding 'MX_DATA_PORT' as a define or variable twice in the same program is illegal.
If it is the same value each time you can add the code (examples only):
Code: Select all
#ifndef MX_DATA_PORT
#define MX_DATA_PORT xyz
#endif
Or:
Code: Select all
#ifndef MX_DATA_PORT
UINT8 MX_DATA_PORT = xyz;
#define MX_DATA_PORT MX_DATA_PORT
#endif
You could customise each individual component for different values using the code:
Code: Select all
#ifdef MX_DATA_PORT
#undef MX_DATA_PORT
#endif
#define MX_DATA_PORT unique_xyz
Or:
Code: Select all
UINT8 Unique_Var_Name = xyz;
#ifdef MX_DATA_PORT
#undef MX_DATA_PORT
#endif
#define MX_DATA_PORT Unique_Var_Name
I hope this makes sense. Good luck,
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Fri May 10, 2013 11:51 pm
by Jordy101091
Jonny,
Could you help me with adjusting the costum code file so I can use it in Flowcode,
I have tried to get it to work today but no success.
Regards Jordy
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Mon May 13, 2013 10:41 pm
by JonnyW
Hi Jordy.
Sorry for the late reply. I'm afraid with the pressures of Flowcode v6 I don't have much at the moment. If you post the custom code file here then I or someone else can have a look at it, but I cant promise anything at the moment.
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Tue May 14, 2013 4:40 am
by Jordy101091
Thanks jonny,
I will post the costum code file when I get back from work.
Maybe you have some time in your lunch break

.
Anyway thanks for the effort.
By-the-way how is it going with v6?
Thanks again,
Jordy
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Tue May 14, 2013 10:50 am
by JonnyW
Hi Jordy. OK, no probs.
v6 is going well - still a lot to do but things are coming together and becoming stable. Just in the final stages now but always working I haven't had a lunch break in a long time!
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Tue May 14, 2013 9:14 pm
by Jordy101091
Hi Jonny,
I'm really curious about the new futures in Flowcode version 6.
Do you already have a prediction of the release date??
Anyway lets stay on topic should we
Here is the costum code for the KS0108 Display.
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Tue May 14, 2013 10:17 pm
by JonnyW
Evening.
Here is an unfinished bit of code for your custom LCD. You will have to find a way of changing the unique identifier for each instance - through the custom code will work.
The code is commented, the keys are the MX_LCD_INSTANCE, MX_UNIQUE and MX_LCD_INITIALISED defines.
Good luck with it, I hope this is enough to go on (and the code compiles - I haven't tried this - there may be typos!)
V6 is hopefully a couple of months away, and offers a lot of functionality to package your own components, including simulation. Deadlines are very tight though, so dates are only pencilled in at present.
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Wed May 15, 2013 5:57 pm
by Jordy101091
Hi Jonny can you tell me what to do,
I was thinking that I need to rename all these defines:
Code: Select all
//Common defines
#define MX_DATA_PORT %a
#define MX_DATA_TRIS %b
#define MX_CONTROL_PORT %c
#define MX_CONTROL_TRIS %d
#define MX_CS1 %e
#define MX_CS2 %f
#define MX_DAT_INST %g
#define MX_ENABLE %h
#define MX_READ_WRITE %i
For lets say this:
#define MX_DATA_PORT1 %a
#define MX_DATA_TRIS1 %b
#define MX_CONTROL_PORT1 %c
#define MX_CONTROL_TRIS1 %d
ect...
Is this correct or do I misunderstand you
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Wed May 15, 2013 6:51 pm
by JonnyW
Hello.
Variables have a location in memory tied to their name. You can not do:
char VALUE = 0;
char VALUE = 1;
As there is now two locations for 'VALUE'.
#defines do not have this limitation. You can do:
#define VALUE 0
#undef VALUE
#define VALUE 1
The posted code redefines the MX_DATA_PORT etc connection stuff by un-defining the previous version. You can give them all different names, but this is only needed if they are used in the same place. If they are used one after another as the components are added you can define, use, undefine, define, use.
I hope this makes sense.
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Mon May 20, 2013 11:33 am
by Jordy101091
Hi jonny,
I have tried all weekend to make the custom code to work but I cant get it to work at all,
I'm afraid to ask but can you wave your magic wand for me
As I'm trying I don't see where I'm going wrong, And i do not have enough brain cells to understand this sort of coding

.
I hope you have some time for me,
Anyway, Thanks
Jordy
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Mon May 27, 2013 8:45 pm
by Jordy101091
A gentle topic kick, In the hope that jonny has some time to look at my problem.
Don't want to push anyone because I know your all busy at the moment

Re: Using 2 Costum Code Blocks !!Help!!
Posted: Mon May 27, 2013 9:33 pm
by JonnyW
Hi Jordy.
With the code I posted are you still getting the same errors? The #undef of these should remove any prior references. If the errors have changed please post what you have so far.
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Wed May 29, 2013 8:44 pm
by Jordy101091
Jonny this is the following error message I'm getting when I compile the code:
Code: Select all
File name: \\NASHJJAKL\Jordy Kleian\Documenten\Flowcode Projects\Projecten\Power Supply Rev.2\uC Display\Display.c
Title:
Description:
Generated by: Flowcode v5.5.2.1
Date: Wednesday, May 29, 2013 21:42:21
Licence: Professional
Registered to: Jordy Kleian
Licence key: H8NNFC
http://www.matrixmultimedia.com
De compiler wordt gestart...
C:\Program Files (x86)\Flowcode\v5\Tools\boostc\boostc_pic18_flowcode.exe -v -t PIC18F6722 "Display.c"
BoostC Optimizing C Compiler Version 7.04 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday
Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited
Display.c
Starting preprocessor: C:\PROGRA~2\Flowcode\v5\Tools\boostc\pp.exe Display.c -i C:\PROGRA~2\Flowcode\v5\Tools\boostc\include -d _PIC18F6722 -la -c2 -o Display.pp -v -d _BOOSTC -d _PIC18 -d _CHAR_INDEX
..
Display.c(1590): error: unexpected identifier
Display.c(1592): error: unexpected identifier
Display.c(1658): error: unexpected identifier
Display.c(1667): error: unexpected identifier
Display.c(1673): error: unexpected identifier
Display.c(1677): error: unexpected identifier
Display.c(1685): error: unexpected identifier
Display.c(1709): error: missing semicolon
Display.c(1709): error: unexpected identifier
Display.c(1732): error: unexpected identifier
Display.c failure
failure
Resultaat = 1
Flowcode kan de C-code niet vertalen vanwege de volgende fout:
Als de flowchart C-code bevat, controleer die dan zorgvuldig. Als de flowchart geen C-code bevat of als die gegarandeerd vrij is van fouten, neem dan contact op met de technische ondersteuning.
KLAAR
Evening.
Here is an unfinished bit of code for your custom LCD. You will have to find a way of changing the unique identifier for each instance - through the custom code will work.
FC5_PIC_Custom-1.c
(23.64 KiB) Downloaded 12 times
The code is commented, the keys are the MX_LCD_INSTANCE, MX_UNIQUE and MX_LCD_INITIALISED defines.
Good luck with it, I hope this is enough to go on (and the code compiles - I haven't tried this - there may be typos!)
V6 is hopefully a couple of months away, and offers a lot of functionality to package your own components, including simulation. Deadlines are very tight though, so dates are only pencilled in at present.
Jonny
Do you know where the problem is.
Also an apology for the late response, I'm currently very busy with work and school.
Regards Jordy
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Sat Jun 01, 2013 10:33 pm
by JonnyW
Hi Jordy, I know the feeling - will reply when I can though.
With any compiler output messages it also helps to post the generated C code program - or if the code is sensitive the part around the error lines at a minimum. You can PM if it is commercial.
From what that looks like I would guess some of the code I posted had a typo somewhere, or I have used the wrong types to declare variables, but that is only a guess without seeing what code is on those lines in the C file.
Remember the code I posted was unfinished and needed the macro names changing over to MXU_... - if you post what you have so far I can perhaps take a look and see if I can see any issues.
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Sun Jun 02, 2013 9:59 pm
by Jordy101091
Hi Jonny here is the C Code generated from the Flowcode file,
I hope you can find something in here,
I wont be able to reply tomorrow because I have some major exams to do for the success of my education.
Anyway let me know if you find something.
Regards Jordy
PS. Thanks for all the effort.
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Sun Jun 02, 2013 10:18 pm
by JonnyW
Hello.
You have a bad define at the top of your second component:
Code: Select all
//Common defines
#define MX_DATA_PORT portf my value
#define MX_DATA_TRIS trisf
The 'my value' should not be there. If you remove and rebuild this might be better.
Good luck in your exams.
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Mon Jun 03, 2013 3:28 pm
by Jordy101091
Jonny,
I have tried to remove this issue in the custom code, but when I go into Flowcode and click on the component to view the code,
I cannot seem to find this my value typo anywhere, When I go to the C Code file I can find this typo and delete it rebuild the code and is gives the same error message.
And the Typo returns in the C Code file,
What can I do
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Mon Jun 03, 2013 9:24 pm
by kersing
Could you check the component properties for the value? Or post your flow chart for us to check?
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Tue Jun 04, 2013 9:34 am
by Benj
Hi Jordy,
Sounds like your editing the project C file rather then the custom component C file. This can be found in the Flowcode/Components directory or you can use the code customization feature to override the component C file.
However if this is not the issue I have had problems before when trying to make changes to files in program files. The changes look to have worked but reloading the file and the changes have dissapeared. Try copying out the file from program files before editing or ensure your text editor is running with admin permissions to overcome this issue.
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Tue Jun 04, 2013 5:44 pm
by Jordy101091
Oke I have figured out on how to remove this "my variable" thing in the C Code,
I have compiled the code again and this is what is says.
Code: Select all
File name: \\NASHJJAKL\Jordy Kleian\Documenten\Flowcode Projects\Projecten\Power Supply Rev.2\uC Display\Display.c
Title:
Description:
Generated by: Flowcode v5.5.2.1
Date: Tuesday, June 04, 2013 18:43:13
Licence: Professional
Registered to: Jordy Kleian
Licence key: H8NNFC
http://www.matrixmultimedia.com
De compiler wordt gestart...
C:\Program Files (x86)\Flowcode\v5\Tools\boostc\boostc_pic18_flowcode.exe -v -t PIC18F6722 "Display.c"
BoostC Optimizing C Compiler Version 7.04 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday
Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited
Display.c
Starting preprocessor: C:\PROGRA~2\Flowcode\v5\Tools\boostc\pp.exe Display.c -i C:\PROGRA~2\Flowcode\v5\Tools\boostc\include -d _PIC18F6722 -la -c2 -o Display.pp -v -d _BOOSTC -d _PIC18 -d _CHAR_INDEX
................
Display.c(1443:12): error: variable 'ASCII1' already exists
Display.c(1455:12): error: variable 'ASCII2' already exists
Display.c(1467:12): error: variable 'ASCII3' already exists
Display.c(1479:12): error: variable 'ASCII4' already exists
Display.c(1491:12): error: variable 'ASCII5' already exists
Display.c(1503:12): error: variable 'ASCII6' already exists
Display.c(1515:12): error: variable 'ASCII7' already exists
Display.c(1527:12): error: variable 'ASCII8' already exists
Display.c(1555:7): error: Function 'MX_LCD_Enable' already has a body
Display.c success
failure
Resultaat = 1
Flowcode kan de C-code niet vertalen vanwege de volgende fout:
Als de flowchart C-code bevat, controleer die dan zorgvuldig. Als de flowchart geen C-code bevat of als die gegarandeerd vrij is van fouten, neem dan contact op met de technische ondersteuning.
KLAAR
I have attached a new copy of the C Code File
Regards Jordy
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Wed Jun 05, 2013 9:05 am
by JonnyW
Hi. OK, no probs.
You will need to change the custom code tolook like this:
Code: Select all
//ASCII Pixel data
#ifndef MX_FCD_CUSTOMCMPNT
#define MX_FCD_CUSTOMCMPNT
rom char* ASCII1 = {0x00 , 0x00 , 0x00 , 0x00 , 0x00, // space // 32 - 43
0x00 , 0x06 , 0x5F , 0x06 , 0x00, // !
And at the end of the list:
Code: Select all
rom char* ASCII8 = {0x04 , 0x3E , 0x44 , 0x24 , 0x00, // t // 116 - 126
0x3C , 0x40 , 0x20 , 0x7C , 0x00, // u
0x1C , 0x20 , 0x40 , 0x20 , 0x1C, // v
0x3C , 0x60 , 0x30 , 0x60 , 0x3C, // w
0x6C , 0x10 , 0x10 , 0x6C , 0x00, // x
0x9C , 0xA0 , 0x60 , 0x3C , 0x00, // y
0x64 , 0x54 , 0x54 , 0x4C , 0x00, // z
0x08 , 0x3E , 0x41 , 0x41 , 0x00, // {
0x00 , 0x00 , 0x7F , 0x00 , 0x00, // |
0x00 , 0x41 , 0x41 , 0x3E , 0x08, // }
0x02 , 0x01 , 0x02 , 0x01 , 0x00}; // ~
#endif // #ifndef MX_FCD_CUSTOMCMPNT
This will mean those arrays are only included once in the C file, which will allow us to get to the next error!
Good luck,
Jonny
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Sat Jun 08, 2013 3:54 pm
by Jordy101091
Oke I have made the changes,
This is the following error message that im gettin.
Code: Select all
File name: \\NASHJJAKL\Jordy Kleian\Documenten\Flowcode Projects\Projecten\Power Supply Rev.2\uC Display\Display.c
Title:
Description:
Generated by: Flowcode v5.5.2.1
Date: Saturday, June 08, 2013 16:54:32
Licence: Professional
Registered to: Jordy Kleian
Licence key: H8NNFC
http://www.matrixmultimedia.com
De compiler wordt gestart...
C:\Program Files (x86)\Flowcode\v5\Tools\boostc\boostc_pic18_flowcode.exe -v -t PIC18F6722 "Display.c"
BoostC Optimizing C Compiler Version 7.04 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday
Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited
Display.c
Starting preprocessor: C:\PROGRA~2\Flowcode\v5\Tools\boostc\pp.exe Display.c -i C:\PROGRA~2\Flowcode\v5\Tools\boostc\include -d _PIC18F6722 -la -c2 -o Display.pp -v -d _BOOSTC -d _PIC18 -d _CHAR_INDEX
???(2868): Unterminated conditional
1 errors detected
Error: preprocessing error
failure
Resultaat = 1
Flowcode kan de C-code niet vertalen vanwege de volgende fout:
Als de flowchart C-code bevat, controleer die dan zorgvuldig. Als de flowchart geen C-code bevat of als die gegarandeerd vrij is van fouten, neem dan contact op met de technische ondersteuning.
KLAAR
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Sat Jun 08, 2013 4:02 pm
by kersing
Could you post your flowchart and the custom component you are using?
Re: Using 2 Costum Code Blocks !!Help!!
Posted: Sat Jun 08, 2013 5:37 pm
by Mantas
Try adding another #endif after the last #endif...
BR,
Mantas