Hi,
I'm using FLOWCODE V3.0.4.29 Pro version.
Are there examples available on how to make macros.
Thanks in advance
Patrick
Parameters not passed to an own written macro
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
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.
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:
Code: Select all
AddOne.Return = AddOne.in + 1

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.
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
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