Page 1 of 1

Simulation Macros

Posted: Sat Apr 05, 2014 10:45 pm
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

Re: Simulation Macros

Posted: Mon Apr 07, 2014 11:35 am
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.

Re: Simulation Macros

Posted: Mon Apr 07, 2014 1:03 pm
by Jordy101091
Thanks Steve,

Now it works just fine.

Regards Jordy