Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dsp.LogicAnalyzer System object

Visualize, measure, and analyze transitions and states over time

Description

The Logic Analyzer System object™ displays the transitions in time-domain signals.

  • Debug and analyze models

  • Trace and correlate many signals simultaneously

  • Detect and analyze timing violations

  • Trace system execution

  • Detect signal changes using triggers

To display the transitions of signals in the Logic Analyzer:

  1. Create the dsp.LogicAnalyzer object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

For more information about how to configure and customize the Logic Analyzer, see Logic Analyzer.

Creation

Syntax

scope = dsp.LogicAnalyzer
scope = dsp.LogicAnalyzer(Name,Value)

Description

scope = dsp.LogicAnalyzer creates a Logic Analyzer System object, scope.

scope = dsp.LogicAnalyzer(Name,Value) sets properties using one or more name-value pairs. Enclose each property name in single quotes.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects (MATLAB).

Background color of the display, specified as 'Black' or 'White'.

Tunable: Yes

Data Types: char

Color for channels in the display, specified as an RGB triplet.

An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7].

Tunable: Yes

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Font size for channels in the display, in points, specified as a nonnegative scalar integer.

Tunable: Yes

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Format for channels in the display, specified as one of the following:

  • 'Automatic' — Displays floating-point signals in Analog format and integer and fixed-point signals in Digital format. Boolean signals are displayed as zero or one.

  • 'Analog' — Shows values as an analog plot.

  • 'Digital' — Shows values as digital transitions.

Tunable: Yes

Data Types: char

Channel height in the display, in pixels, specified as a positive real scalar in the range 8 to 200.

Tunable: Yes

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Base of the enumeration used to display values, specified as one of the following:

  • 'Hexadecimal' — Displays values as symbols from zero to nine and A to F

  • 'Binary' — Displays values as zeros and ones

  • 'Octal' — Displays values as numbers from zero to seven

  • 'Signed decimal' — Displays the signed, stored integer value

  • 'Unsigned decimal' — Displays the stored integer value

This property applies only to fixed-point (fi) values.

Tunable: Yes

Data Types: char

Spacing between channels in the display, in pixels, specified as a positive scalar integer.

Tunable: Yes

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Caption to display on the scope window, specified as a character vector.

Tunable: Yes

Data Types: char

Number of input ports, specified as a positive integer. Each signal coming through an input port becomes a separate channel in the scope. You must invoke the scope with the same number of inputs as the value of this property.

Position of the scope window on your screen, in pixels, specified as a [left bottom width height] vector. The default position depends on your screen resolution. By default, the scope window appears in the center of your screen, with a width of 800 pixels and height of 600 pixels.

Tunable: Yes

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Sample time of inputs in seconds, specified as a finite numeric scalar. The same sample time is used for all inputs.

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Time display offset in seconds, specified as a nonnegative scalar.

Tunable: Yes

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Time span in seconds, specified as a positive scalar. The x-axis limits are calculated as follows:

  • Minimum x-axis limit = min(TimeDisplayOffset)

  • Maximum x-axis limit = max(TimeDisplayOffset) + TimeSpan

TimeDisplayOffset and TimeSpan are the values of their respective properties.

Tunable: Yes

Data Types: double | single | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

Usage

For versions earlier than R2016b, use the step function to run the System object™ algorithm. The arguments to step are the object you created, followed by the arguments shown in this section.

For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Syntax

scope(signal)
scope(signal1,signal2,...signalN)

Description

scope(signal)displays the signal signal in the Logic Analyzer scope.

scope(signal1,signal2,...signalN) displays multiple signals in the Logic Analyzer when you set the NumInputPorts property to N. Each signal can have different data types and dimensions.

Input Arguments

expand all

Specify one or more input signals to visualize in the dsp.LogicAnalyzer. Signals can have different data types and dimensions.

Example: scope(signal1, signal2)

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char | string | struct | table | cell | categorical | datetime | fi

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)
addCursorAdd cursor to display
addDividerAdd divider to Logic Analyzer
addWaveAdd wave corresponding to specified input
deleteCursorDelete Logic Analyzer cursor
deleteDisplayChannelDelete Logic Analyzer channel
getCursorInfoReturn settings for Logic Analyzer cursor
getCursorTagsReturn all cursor tags
getDisplayChannelInfoReturn settings for display channel
getDisplayChannelTagsReturn all display channel tags
modifyCursorModify properties of Logic Analyzer cursor
modifyDisplayChannelModify properties of Logic Analyzer display channel
moveDisplayChannelMove position of Logic Analyzer display channel
showDisplay scope window
hideHide scope window
stepRun System object algorithm
cloneCreate duplicate System object
getNumInputsNumber of inputs required to call the System object
getNumOutputsNumber of outputs from calling the System object
isLockedDetermine if System object is locked
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

expand all

Create a dsp.LogicAnalyzer object. Call the scope in a loop to display the signals.

scope = dsp.LogicAnalyzer('NumInputPorts',3);
for ii = 1:20
    scope(ii,10*ii,20*ii);
end

Create a dsp.LogicAnalyzer object with four channels. Call modifyDisplayChannel to set the radix of each of the channels. Run the scope in a loop to display the waves.

scope = dsp.LogicAnalyzer('NumInputPorts',4,'DisplayChannelFormat','Digital');
scope.TimeSpan = 12;

modifyDisplayChannel(scope,1,'Name','Index','Radix','Unsigned decimal');
modifyDisplayChannel(scope,2,'Name','Fi_hex','Radix','Hexadecimal');
modifyDisplayChannel(scope,3,'Name','Fi_bin','Radix','Binary');
modifyDisplayChannel(scope,4,'Name','Fi_actual','Radix','Signed decimal');

for ii = 1:20
    fival = fi((ii-1)/16,0,4,4);
    scope(ii,fival,fival,fival);
end

Define a WeekDaysInt class to hold an enumerated list of weekday values. Create and save the following class definition file.

classdef WeekDaysInt < int32
  enumeration
    Monday(1), Tuesday(2), Wednesday(3), Thursday(4), Friday(5)
  end
end

Create a dsp.LogicAnalyzer object and configure the vector, complex, and enumerated data signals.

scope = dsp.LogicAnalyzer('NumInputPorts',6);
waves = getDisplayChannelTags(scope);

modifyDisplayChannel(scope,waves{1},'InputChannel',1,'Name','Vector Digital');
modifyDisplayChannel(scope,waves{2},'InputChannel',2,'Name','Vector Analog',...
    'Format','Analog','Height',80);
modifyDisplayChannel(scope,waves{3},'InputChannel',3,'Name','Complex Digital');
modifyDisplayChannel(scope,waves{4},'InputChannel',4,'Name','Complex Analog',...
    'Format','Analog','Height',80,'Color','Green');
modifyDisplayChannel(scope,waves{5},'InputChannel',5,'Name','Enum Digital');
modifyDisplayChannel(scope,waves{6},'InputChannel',6,'Name','Enum Analog',...
    'Format','Analog','Height',80);

Call the scope object in a loop to display the signals.

stop = 30;
for count = 1:stop
    sinValVec       = sin(count/stop*2*pi);
    cosValVec       = cos(count/stop*2*pi);
    cosValVecOffset = cos((count+10)/stop*2*pi);
    sinValReal      = sin((count+2)/stop*2*pi);
    cosValImag      = cos((count+2)/stop*2*pi);

    % Create a weekday enumerated value by wrapping the index
    day = WeekDaysInt(1+mod(count-1,5));

    scope(...
          [count (count-(stop/2))],...              % digital vector
          [sinValVec cosValVec cosValVecOffset],... % analog vector
          complex((count-(stop/2)),count),...       % digital complex
          complex(sinValReal, cosValImag),...       % analog complex
          day,...                                   % digital enum
          day...                                    % analog enum
          )
end

Tips

  • To close the logic analyzer window and clear its associated data, use the MATLAB® clear function.

Introduced in R2013a

Was this topic helpful?