How to create a component with multiple return values

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times

How to create a component with multiple return values

Post by tiny »

I need a specific function for a project that creates a string of decimal or hex values from a delimited string and outputs the number of separators.

Is it possible to create a component that returns these two values?
I always get only a "return value".
Has anyone ever tried this and can give me some tips?

In the attached file is an example of the function, the return values are here SepCount (number of separators) and StrArray (string with decimal or hex data).

Thanks for any help!
Christina
Flowcode1.fcfx
(10.92 KiB) Downloaded 247 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: How to create a component with multiple return values

Post by QMESAR »

Christina,

Not sure however this might help you to understand how you can create your own components that can do what you need Hope this helps :D

http://www.matrixtsl.com/mmforums/viewt ... 63&t=17975

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times

Re: How to create a component with multiple return values

Post by tiny »

Thanks for the answer!

I've looked at everything I've found about component creation. I need a function, where I can pass parameters in the flowchart (as with a display or RS232 or similar), this example does not seem to work. The calculation is made when you enter it in the Properties window. The examples just provide only one return value, which is too little for me. I would like to keep the programming a bit more compact and not have so many macros, which are also very complex in the simulation.

Christina

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: How to create a component with multiple return values

Post by kersing »

Hi Christina,

A component can only return one value. A work around if your values are < 256 and > 0 could be to use an string and use the first element of the string for the first return value, the second for a second return value etc. An other way would be to use a global variable, set it in the macro and copy the value immediately after calling the macro (that macro should not be called from an interrupt or horrible things will happen).

Best regards,

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times

Re: How to create a component with multiple return values

Post by tiny »

Thanks for the reply, Kersing!
Then I continue with macros.

Christina

Post Reply