Documentation

Target Computer Commands

You have a limited set of commands that you can use to work the real-time application after it has been loaded to the target computer, and to interface with the scopes for that application.

The target computer command-line interface enables you to work with target and scope objects in a limited capacity. Functions let you interact directly with the scope or target. Property commands let you work with target and scope properties. Variable commands let you alias target computer command-line interface commands to names of your choice.

Refer to Control Real-Time Application at Target Computer Command Line for a description of how to use these functions and commands.

Target Object Function Commands

When you are using the target computer command-line interface, target object functions are limited to starting and stopping the real-time application.

The following table lists the syntax for the target commands that you can use on the target computer. The equivalent MATLAB® syntax is shown in the right column. The target object name tg is used as an example for the MATLAB functions. These functions assume that you have already loaded the real-time application onto the target computer.

Target Computer Command

Description

MATLAB Equivalent

start

Start the real-time application currently loaded on the target computer.

start(tg)

stop

Stop the real-time application currently running on the target computer.

stop(tg)

reboot

Restart the target computer.

reboot(tg)

Target Object Property Commands

When you are using the target computer command-line interface, target object properties are limited to parameters, signals, stop time, and sample time. Note the difference between a parameter index (0, 1, . . .) and a parameter name (P0, P1, . . .).

The following table lists the syntax for the target commands that you can use to manipulate target object properties. The MATLAB equivalent syntax is shown in the right column, and the target object name tg is used as an example for the MATLAB functions.

Target Computer Command

Description

MATLAB Equivalent

getpar param_index

Display the value of a block parameter using the parameter index.

getparam(tg, param_index)

setpar param_index = number

Change the value of a block parameter using the parameter index.

setparam(tg, param_index, number)

stoptime = number

stoptime = Inf

With the value number, run for the specified number of seconds.

With the value Inf, run the real-time application until you manually stop it or reset the target computer.

tg.StopTime = number

tg.StopTime = Inf

sampletime = number

Enter a new sample time.

tg.SampleTime = number

P#

Display the value of the block parameter with index #.

For example, P2 displays the value of block parameter 2.

getparam(tg, param_index)

S#

Display the value of the signal with index #.

For example, S2 displays the value of signal 2.

getsignal(tg, sig_index)

Scope and Video Object Function Commands

When using the target computer command-line interface, you use scope object functions to start a scope and add signal traces. You can also collapse scopes and video displays into icons and expand them again. Notice that the functions addscope and remscope are target object functions on the development computer, and notice the difference between a signal index (0, 1, . . .) and a signal name (S0, S1, . . .).

The following table lists the syntax for the target commands that you can use on the target computer. The MATLAB equivalent syntax is shown in the right column. The target object name tg and the scope object name sc are used as an example for the MATLAB functions.

Target Computer Command

Description

MATLAB Equivalent

addscope

addscope scope_index

Without an argument, add a target scope and assign it the next available index.

With argument scope_index, add a target scope and assign it index scope_index.

addscope(tg, 'target')

addscope(tg, 'target', scope_index)

remscope scope_index

remscope all

With value scope_index, remove scope scope_index.

With value all, remove all scopes.

remscope(tg, scope_index)

remscope(tg)

startscope scope_index

startscope all

With value scope_index, start the scope with index scope_index.

With value all, start all scopes.

start(sc)

start(getscope(tg))

stopscope scope_index

stopscope all

With value scope_index, stop the scope with index scope_index.

With value all, stop all scopes.

stop(sc)

stop(getscope(tg))

addsignal scope_index = sig_index1, sig_index2, ...

With values sig_index1, sig_index2, ..., add the signals with these signal indexes to the scope with index scope_index.

addsignal(sc, sig_index_vector)

remsignal scope_index = sig_index1, sig_index2, ...

remsignal scope_index

With values sig_index1, sig_index2, ..., remove the signals with these signal indexes from the scope with index scope_index.

Without a sig_index value, remove all the signals from the scope with index scope_index.

remsignal(sc, sig_index_vector)

remsignal(sc)

show Scope scope_index

With value scope_index, expand scope scope_index from an icon.

 

hide Scope scope_index

With value scope_index, collapse scope scope_index into an icon.

 

show Video video_index

With value video_index, expand video display video_index from an icon.

 

hide Video video_index

With value video_index, collapse video display video_index into an icon.

 

Scope Object Property Commands

When you use the target computer command-line interface, scope object properties are limited to those shown in the following table. Notice the difference between a scope index (0, 1, . . .) and the MATLAB variable name for the scope object on the development computer. The scope index is indicated in the top left corner of a scope window (SC0, SC1, . . .).

If a scope is running, you need to stop the scope before you can change a scope property.

The following table lists the syntax for the target properties that you can set on the target computer. The equivalent MATLAB syntax is shown in the right column. The scope object name sc is used as an example for the MATLAB functions

Target Computer Command

Description

MATLAB Equivalent

numsamples scope_index = number

Set the number of contiguous samples captured by scope scope_index to number.

sc.NumSamples = number

decimation scope_index = 1

decimation scope_index = number

With value 1, the scope returns all sample points.

With value n, the scope returns every nth sample point.

sc.Decimation = 1

sc.Decimation = number

grid scope_index on

grid scope_index off

With value on, the scope grid display is visible.

With value off, the scope grid display is not visible.

sc.Grid = 'on'

sc.Grid = 'off'

scopemode scope_index = 0

scopemode scope_index = numerical

scopemode scope_index = 1

scopemode scope_index = redraw

scopemode scope_index = 3

scopemode scope_index = rolling

With value 0 or numerical, scope scope_index displays signal values as text.

With value 1 or redraw, scope scope_index plots signal values when numsamples samples has been acquired.

With value 3 or rolling, scope scope_index plots signal values at every sample time.

    Note:   Value 2, sliding, will be removed in a future release. It behaves like value 3, rolling.

sc.DisplayMode = 'numerical'

sc.DisplayMode = 'redraw'

sc.DisplayMode = 'rolling'

triggermode scope_index = 0

triggermode scope_index = freerun

triggermode scope_index = 1

triggermode scope_index = software

triggermode scope_index = 2

triggermode scope_index = signal

triggermode scope_index = 3

triggermode scope_index = scope

With value 0 or freerun, scope scope_index triggers on every sample time.

With value 1 or software, scope scope_index triggers from Command Window.

With value 2 or signal, scope scope_index triggers when a designated signal changes state.

With value 3 or scope, scope scope_index triggers when a designated scope triggers.

sc.TriggerMode = 'freerun'

sc.TriggerMode = 'software'

sc.TriggerMode = 'signal'

sc.TriggerMode = 'scope'

numprepostsamples scope_index = number

Number of samples collected before or after a trigger event.

sc.NumPrePostSamples = number

triggersignal scope_index = sig_index

If triggermode is signal, triggersignal identifies the block output signal to use for triggering the scope.

sc.TriggerSignal = sig_index

triggersample scope_index = number

If triggermode is scope, triggersample specifies which sample of the triggering scope the current scope triggers on.

sc.TriggerSample = number

triggerlevel scope_index = number

If triggermode is signal, triggerlevel indicates the value the signal has to cross to trigger the scope to start acquiring data.

sc.TriggerLevel = number

triggerslope scope_index = 0

triggerslope scope_index = either

triggerslope scope_index = 1

triggerslope scope_index = rising

triggerslope scope_index = 2

triggerslope scope_index = falling

If triggermode is signal:

With value 0 or either, the signal triggers the scope when it crosses triggerlevel in either the rising or falling directions.

With value 1 or rising, the signal triggers the scope when it crosses triggerlevel in the rising direction.

With value 2 or falling, the signal triggers the scope when it crosses triggerlevel in the falling direction.

sc.TriggerSlope = 'Either'

sc.TriggerSlope = 'Rising'

sc.TriggerSlope = 'Falling'

triggerscope scope_index = scope_index2

If triggermode is scope, triggerscope identifies the scope to use for a trigger.

sc.TriggerScope = scope_index2

triggerscopesample scope_index= integer

If triggermode is scope, triggerscopesample specifies which sample of the triggering scope to trigger on.

sc.TriggerScopeSample = integer

ylimit scope_index = min_y, max_y

ylimit scope_index = auto

With value min_y, max_y, change the lower and upper y-axis values to min_y and max_y.

With value auto, allow the lower and upper y-axis values to be determined by the values being displayed.

sc.YLimit = [min_y, max_y]

sc.YLimit = 'auto'

Aliasing with Variable Commands

You can set a variable to a command string, and later use that variable to execute that command. For example, type the following on the target computer command line:

setvar aa = startscope 2
setvar bb = stopscope 2

Later, to start and stop scope 2, you can type the following:

aa
bb

The following table lists the syntax for the aliasing variable commands that you can use only on the target computer. There is no MATLAB equivalent syntax. For a usage example, see Alias Commands at Target Computer Command Line.

Target Computer Command

Description

setvar variable_name = command

Set a variable to a target computer command line string.

getvar variable_name

Display the value of a variable.

delvar variable_name

Delete a variable.

delallvar

Delete all variables.

showvar

Display a list of variables.

Was this topic helpful?