Hey
Is it possible to costomize the C-code in connection to variable declaration in FlowCode 7? I have found out that it is possible with most of the blocks in the Flow-diagram, but i can't find the functionality in connection to variable declarations.
I'm working on a project with 3 arrays which is placed in two memory Banks of a PIC16F88. However I would like to enlarge all of them, so that 3-banks are needed however, this makes the XC8 compiler complain about not beeing able to find space for all 3 arrays, so I would like to see what happens if I force the variables to be in certain banks by the use of absolute variables, which implies that I need to add the following to the declaration of the variables: '@ address'.
My goal is to make 3 60-byte arrays fit into 3-banks of 80 or 96 bytes each. All other variables in the program should be able to fit in the remaining space of the microcontroller.
- Andreas
Is C-code costomization of variable-declaration possible?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Is C-code costomization of variable-declaration possible
Hello Andreas,
Yes this is possible using the AddVar event macro.
I've attached an example for you which generates the following code.
Yes this is possible using the AddVar event macro.
I've attached an example for you which generates the following code.
Code: Select all
MX_GLOBAL MX_UINT8 FCV_TESTVAR[FCVsz_TESTVAR] @ 0x1000;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 17
- Joined: Tue Jan 17, 2017 6:10 pm
- Has thanked: 4 times
- Been thanked: 1 time
- Contact:
Re: Is C-code costomization of variable-declaration possible
Hej Benj
Thank you so much for your answer, it just worked right away. Only a few changes had to be made to make it work for all three variables. You have saved my day.
Events is a bit new to me, and until now I didn't really think it could be used to much else than simulation purposes, which I still find irrelevant for me. But I see now that events might be useful for me later. So I would like to hear if you can tell me if there is somewhere I can read about the different Events? For example how can one know that three parameters are needed for the macro associated with the AddVar event you used?
- Andreas
Thank you so much for your answer, it just worked right away. Only a few changes had to be made to make it work for all three variables. You have saved my day.
Events is a bit new to me, and until now I didn't really think it could be used to much else than simulation purposes, which I still find irrelevant for me. But I see now that events might be useful for me later. So I would like to hear if you can tell me if there is somewhere I can read about the different Events? For example how can one know that three parameters are needed for the macro associated with the AddVar event you used?
- Andreas
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Is C-code costomization of variable-declaration possible
Hi Andreas,
You can find a complete breakdown of the simulation API and Events here.
https://www.matrixtsl.com/wikiv7/index. ... ctionality
It's very powerful but we need to keep working on the documentation to bring it up a level so it's usable and easy to work with.
To enable a new event you simply go to the events tab of the project explorer window, click the event you want to use and then double click the create new macro and it will automatically create you a macro with all the relevant parameters etc.
The GetVarSize is another useful one for manipulating the size of an array variable at compile time, maybe based on a user property.
You can find a complete breakdown of the simulation API and Events here.
https://www.matrixtsl.com/wikiv7/index. ... ctionality
It's very powerful but we need to keep working on the documentation to bring it up a level so it's usable and easy to work with.
To enable a new event you simply go to the events tab of the project explorer window, click the event you want to use and then double click the create new macro and it will automatically create you a macro with all the relevant parameters etc.
The GetVarSize is another useful one for manipulating the size of an array variable at compile time, maybe based on a user property.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel