In this tutorial, you explore key functionality of the Logic Analyzer, such as choosing and configuring signals to visualize, stepping through a simulation, and measuring transitions.
To follow along with this tutorial, open the Sigma-Delta A/D Conversion
(fixed-point version) model (dspsdadc_fixpt
).
From the Simulink® toolstrip, on the Simulation tab, in the Review
Results gallery, click the Logic Analyzer button .
The Logic Analyzer opens with the selected signals shown in the channel display.
Click Settings. Set the Height to 20 and the Spacing to 10, and then click OK.
From the Logic Analyzer toolstrip, click Add Divider. A divider named
Divider
is added to the bottom of your channels. You can use dividers to separate
signals.
Double-click Divider
and rename Divider
as Analog Input
Calculation
. Drag the divider to the top of the channels pane.
Add another divider and name it Error Calculation
.
From the Logic Analyzer toolstrip, click Add Group. A group named
Group1
is added to the bottom of your channels. You can use groups to group signals in
a collapsible tree structure. Double-click Group1
and rename it as Digital
Approximation Calculation
.
You can visualize the same signal in multiple places. Right-click the Analog
Input(Delayed)
signal and select Copy. Paste this signal under the
Error Calculation
divider. Repeat the process for the CIC Digitized
Approximation
signal. Organize your dividers and signals as shown in the screen shot, and then
collapse the Digital Approximation Calculation
group.
From the Logic Analyzer toolstrip, click Stepping Options.
Select the Enable stepping back option. Specify the Maximum number of
saved back steps as 2
and the Interval between stored back
steps as 100
steps. When you run the simulation, a snapshot of the model
is taken every 100 steps. Only the last snapshot is saved.
Set Move back/forward by to 100
steps.
Select the Pause simulation when time reaches option. Specify the simulation to
pause after 0.2
seconds of model time has elapsed, and then click
OK.
To run the model, click Run on the Logic Analyzer toolstrip. The model runs for 0.2 seconds of model time and then pauses.
Click to fit your data to the time range.
Select all waves under your Analog Input Calculation
divider. Then on the
Waves tab, select a new Wave Color for the selected
waves.
Under the Error Calculation
divider, select the Analog
Input(Delayed)
and CIC Digitized Approximation
waves. On the
Waves tab, modify the Format to
Digital
. The selected waves are now displayed as digital transitions.
On the Logic Analyzer toolstrip, click and then drag-and-drop start and end points to zoom in time.
For waves displayed as digital, you can use the Next Transition and Previous Transition buttons. To move the active cursor to the next transition, click Next Transition.
Click Lock to lock the active cursor in place.
Click Add Cursor to add another cursor to the axes. The cursor shows its current position in time, and the difference from all surrounding cursors in time.
Right-click the second cursor you added and select Delete Cursor.
Press the space bar to zoom out.
Add another cursor and line it up with a low point of the Analog Input
wave in your
Analog Input Calculation
division. Use the value displayed in the wave value pane
to fine-tune the cursor position in time.
Add another cursor and line it up with the corresponding low point of the Analog
Input(Delayed)
wave in your Analog Input Calculation
division.
To move the simulation forward 100 steps, click Step Forward. The time axis adjusts so that you can see the most recent data.
To move the simulation backward 100 steps, click Step Back. The Step Back button becomes disabled because you specified saving only two back step.
When you save your model, the logic analyzer settings are also saved for that model.