Difference between revisions of "DifferentCodeSimAndDownload"
(→Setup) |
(→Setup) |
||
Line 22: | Line 22: | ||
The extra UI trees can be added by '''File''' > '''Global Settings''' > [[Global_Settings#UI_Trees|'''UI Trees''']] tab | The extra UI trees can be added by '''File''' > '''Global Settings''' > [[Global_Settings#UI_Trees|'''UI Trees''']] tab | ||
− | |||
+ | Make sure the vents and Built-in Functions are moved to the Project Explorer window: | ||
− | + | [[File:Sim3.jpg]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 46: | Line 32: | ||
On the project explorer window click on the Events tab. | On the project explorer window click on the Events tab. | ||
− | + | Click on '''+''' of '''Simulation''' to expand. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | We are intrestesred in Simulation '''Start''' and '''Stop''' | |
==Decisions== | ==Decisions== |
Revision as of 11:41, 19 September 2023
Introduction
In some cases it is necessary to use different code for simulation and for download.
Simulation icons automatically get ignored for compilation but often to drive the simulation macros you need additional code such as calculations and variables.
It can therefore be useful to separate out the simulation side code so that it does not consume resources for the embedded target.
Setup
First, add Events and Built-in Functions to project explorer, so it will look like this:
You can reduce the width by dragging, but you will lose the titles:
This only requires doing once
The extra UI trees can be added by File > Global Settings > UI Trees tab
Make sure the vents and Built-in Functions are moved to the Project Explorer window:
Creating Event Macros
On the project explorer window click on the Events tab.
Click on + of Simulation to expand.
We are intrestesred in Simulation Start and Stop
Decisions
You can now add the Sim decisions anywhere in your program where Sim and download need to do different things.
As the decision is referring to a property the generated C code is fixed and so the decision code gets optimised out when downloading to a microcontroller.
Example File
Here is a Flowcode example file showing the completed functionality.