Hi, how exactly work this feature?
I call a macro and at last in W (and also in RET_VALUE var) there is the value that I want to save in "A" variable. First time I used to insert a CALC icon where I put A=RE_VALUE.
So I try to write A in the Return Value window of my Macro but don't work; the value of A is always "1".
OTHER QUEST: there is a way to exit from a macro and jump directly at a Flowcode connection point without having "stack" problems?
Return value from Macro call
- 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:
Hello
Firstly you must create or edit your macro so that it has a return type.
I will set this to a byte in this example.
I have named the macro "mac1"
Now you can use a calculation icon to assign a value to the variable mac1.Return
It should be available from the variables list.
Now the value assigned to the return variable should come through to the returned macro call.
To add a connection point simply add this after the macro call. This should work without any problems.
Firstly you must create or edit your macro so that it has a return type.
I will set this to a byte in this example.
I have named the macro "mac1"
Now you can use a calculation icon to assign a value to the variable mac1.Return
It should be available from the variables list.
Now the value assigned to the return variable should come through to the returned macro call.
To add a connection point simply add this after the macro call. This should work without any problems.
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
- psf
- Posts: 45
- Joined: Mon Jun 25, 2007 9:44 pm
- Location: Italia
- Has thanked: 6 times
- Been thanked: 2 times
Ok I know the problem is like this example:Benj wrote:
To add a connection point simply add this after the macro call. This should work without any problems.
macro1:
start
operation1
operation2
......
......
operation24
decision? no----------->jump to main program connection point A
yes
operation25
end
The problem is that this macro is written in asm; and if I write goto _FCC_connectionpoint0001 I suppose that in the stack pointer the previuos opcode address before call macro1 is still present.
- 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:
Hello
It is not wise to jump around from a macro back to a point in the main program. It is better to return a value from the macro and then use this in the main program to decide where to go.
It is not wise to jump around from a macro back to a point in the main program. It is better to return a value from the macro and then use this in the main program to decide where to go.
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