Simulation Macros

Please add any feature requests for Flowcode version 6 here

Moderator: Benj

Forum rules
Only feature requests will be considered here. General questions should not be posted in this forum.
Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Simulation Macros

Post by Jordy101091 »

Maybe the MM Team can help me with this.

Im working with my vinculum 1 component, and I want to show the user of this component,
the data stream and events that happen within the component.
The way I was thinking of to show this to the user is trough the console window.

Im able to create a new tab "UART - Vinculum 1", I'm also able to put some text in this tab-page.
I have different message colors for, Component Event, Command Event, and a Property Change Event.

To simplify this I have created a macro the takes care of the the color settings and message build up.
So I only have to specify which color the text has and what the two messages are. Then this macro take care of the rest.

But If I want to compile this It shows me a ton of error message, wants I disable the Macro that holds all the simulation macros is compiles fine. So it would be nice if I had the option to make a simulation macro in addition to a "standard" macro.
I hope I have explained myself enough.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
SteveM
Posts: 55
Joined: Tue Mar 25, 2014 2:09 pm
Has thanked: 28 times
Been thanked: 65 times
Contact:

Re: Simulation Macros

Post by SteveM »

Hi Jordy,

If I've understood your question correctly, you should be able to do what you need via the 'Interface Manager' in the component properties panel. Each macro which contains downloadable code is able to have a 'Simulation only' alternative, which will be substituted automatically whenever the flowchart is simulated...
Interface Manager Screenshot.PNG
(91.59 KiB) Downloaded 1872 times
1 (Red) - Open the manager by clicking in the empty field next to the label.
2 (Blue) - Select the downloadable macro that needs to behave differently when simulating.
3 (Green) - Choose an alternative macro from the list for the 'Simulation macro' field (at Matrix, we always prefix these 'Sim_...' to make them stand out, but the names need not be related in any way).

What will happen now is that code running on a chip will run the compiled downloadable code - just as before. But when simulating, all calls to the original macro name will be re-directed to the chosen simulation macro. This means that you don't need to change any macro calls in order to get the simulation working - for example, for the component in the example, all component macro calls would be to "ReadFloat()".

Note that for this to work, the two macros must have exactly the same call signature - i.e. the same combination of inputs, in the same order, all of the same data types; and the same kind of return value (if any). As in the example, the alternative macro can be a hidden one - but it could also be a 'public' simulation macro if you wanted have access to it directly from simulation icons in the flowchart.

Best regards,
Steve.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: Simulation Macros

Post by Jordy101091 »

Thanks Steve,

Now it works just fine.

Regards Jordy
the will to learn, should not be stopped by any price

Post Reply