Page 1 of 1
Parameters not passed to an own written macro
Posted: Thu Jan 04, 2007 3:45 pm
by PDeGr
Hi,
I'm using FLOWCODE V3.0.4.29 Pro version.
Are there examples available on how to make macros.
Thanks in advance
Patrick
Posted: Thu Jan 04, 2007 6:14 pm
by Steve
I don't think we did any examples on this feature. Here's a quick explaination of how it should work:
1) "Macro..New" to create a new macro
2) Enter a name ("AddOne") and a description
3) "Edit Parameters" and add a new BYTE variable called "in"
4) Select "BYTE" as the return type
5) Click "OK" to create the macro
6) Add a single "Calc" icon with the following:
7) "Edit..Variables" to create 2 new BYTE variables: "x" and "y"

In your "main" procedure, add a "Calc" icon with "x=5"
9) Following this, add a "Call Macro" icon. Select your "AddOne" macro, put "x" in as the parameter and "y" in as the return.
10) Step through your program: you should see that y becomes 6 after the "Call Macro" icon has executed.
I hope this helps.
Posted: Fri Jan 05, 2007 12:06 pm
by PDeGr
Hi Steve,
Thanks for the quick reply.
Now it works.
Thanks,
Patrick
Posted: Fri Jan 05, 2007 12:31 pm
by PDeGr
Hi Steve,
It worked fine in simulation.
When I try to compile the program I receive the following error:
macro.c
Starting preprocessor: "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\pp.exe" D:\V3pgm\GPS_V1\test\macro.c -i "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\include" -d _PIC16F88 -la -c2 -o macro.pp -v -d _BOOSTC -d _PIC16
D:\V3pgm\GPS_V1\test\macro.c(75:10): error: unknown identifier 'FCR_RETVAL'
D:\V3pgm\GPS_V1\test\macro.c(75:2): error: error in expression
D:\V3pgm\GPS_V1\test\macro.c(75:2): error: failed to generate expression
macro.c success
failure
...
Return code = 1
I checked the C program and I can't find a line with the decalration of FCR_RETVAL
I can find FCL_RETURN !!
Regards
Patrick
Posted: Fri Jan 05, 2007 12:33 pm
by Steve
Please email your file to me and I'll have a look.
Posted: Fri Jan 05, 2007 12:38 pm
by PDeGr
What is your E-mail?
Do you want the .FCF file or the .C file
Posted: Fri Jan 05, 2007 12:43 pm
by Steve
I should have an email button next to my posts (if not, it's steve [at] matrixmul...... etc) .
Please send me both the fcf and the c files.
Posted: Fri Jan 05, 2007 1:00 pm
by Steve
Hello Patrick,
There seems to be a bug within Flowcode. I will fix it and release an update within a few weeks.
In the meantime, there is a simple work-around. In the "definitions" box of the "supplementary code" window, put the following line in:
#define FCR_RETVAL FCL_RETURN
I hope this helps.
Posted: Fri Jan 05, 2007 1:08 pm
by PDeGr
I added the C code icon with the code in the macro flow and it works fine.
Thanks
Patrick