Using the Data Recorder

From Flowcode Help
Jump to navigationJump to search

<sidebar>Sidebar: What Is a Component?</sidebar>



Scope Introduction

The Data Scope allows the user to see the results and values from raw data and components such as dials and measures. This data is displayed during simulation and allows you to monitor the state of the various signals plotted to the various scope channels.


The Data Scope can read and display data from various different ports simultaneously during simulation and can be adjusted to view the data at various speeds which allowed for increased accuracy or a larger amount of data to be displayed at any time.


The Scope is very useful for analyzing data as it can accurately display information to identify patterns in the data as well as the speed data is being displayed at. Components such as the DSP range will automatically create their own scope channels allowing for very simple yet powerful means of monitoring and debugging the system.


The Scope window is also used with the ICT (In Circuit Test) which is due to be released early 2014 along with the EB006 version 9 hardware.


Gen Data Scope Example 01.png


Creating a scope group


To create a new scope group you first need to create a global handle type variable to store the reference to the scope group. This is basically a unique number which used to refer to that specific group of the scope window. To do this open the Project Explorer window and select the Globals tab. Next right click the Variables portion of the tree view and select Add New from the menu. In the Create a new variable dialogue that pops up give the variable a meaningful name such as ScopeGroupHandle, then switch the variable type to Object Handle and click OK. You should then get a Object handle variable appearing in the Project Explorer window.


Scope1.jpg


Next we need to assign the handle variable with a value by calling the Simulation API. To do this we add a [[Simulation_Macro_Icon_Properties|simulation macro] icon to the Main flowchart and double click the item on the flowchart to edit the icon's properties. Inside the icon property window we first need to ensure that the Functions tab is selected and then scroll down to the Scope section before clicking the + icon to see all the API calls related to the Scope functionality.


Scope2.jpg


The AddGroup function call creates a new named group of streams on the Scope window. The return value the function call requires a handle type variable, luckily we have already created this above.


Scope3A.jpg


The AddStream function call adds a new named stream to the group on the Scope window. The return value the function call requires a handle type variable so we will have to create a new global object handle type variable to store this. This handle must be unique for a single stream so a new object handle variable must exist for every stream on the scope.


Scope3B.jpg


When we run the simulation the new group will be created on the scope window ready for data to be streamed in.


Scope3.jpg


By moving the API call from the Main macro to say the simulation initialise event macro we can create a component which will automatically add our new scope group and stream when the component is added to a program. This is the way that components such as the DSP based components add their data to the console window.


Scope4.jpg


Note that a group with no valid stream handles will not show up on the Scope window.


Assigning the handle variable with the value of 0 using a Calculation icon or calling the System -> DeleteHandle API call will effectively remove the group or stream from the scope window.

Adding a digital pin or port to a stream

Adding an analogue pin to a stream

Adding an custom value to a stream