Hauptinhalt

stopTransmission

Stop background transmission

Since R2026a

Description

Add-On Required: This feature requires the Wireless Testbench Support Package for NI USRP Radios add-on.

stopTransmission(tx) stops continuous IQ waveform background transmission from the specified USRP™ transmitter tx.

example

Examples

collapse all

Create and initialize the transmitter System object. Set the interpolation factor.

sampleRate = 1e6;
tx = comm.SDRuTransmitter(Platform="X310",IPAddress='192.168.40.2',...
    CenterFrequency=2e9,Gain=20);
tx.InterpolationFactor = tx.MasterClockRate/sampleRate;

Create and initialize the receiver System object. Set the decimation factor.

rx = comm.SDRuReceiver(Platform="X310",IPAddress='192.168.40.2',...
    CenterFrequency=2e9,Gain=20);
rx.DecimationFactor = rx.MasterClockRate/sampleRate;

Generate a sine wave for transmission.

sinewave = dsp.SineWave(1,50e3);
sinewave.SampleRate = sampleRate;
sinewave.SamplesPerFrame = 2e4;
sinewave.OutputDataType = 'double';
sinewave.ComplexOutput = true;
txData = sinewave();

Initialize the time scope and spectrum analyzer for visualization.

timeScope = timescope(SampleRate=sampleRate);
spectrumScope = spectrumAnalyzer(SampleRate=sampleRate, ...
ViewType="spectrum");
spectrumScope.PeakFinder.Enabled = true;

Use the transmitRepeat function to transmit the sine wave in the background.

samplePerFrame = 2e4;
stopTime = 1;
transmitRepeat(tx,txData);
## Waveform transmission has started successfully and will repeat indefinitely. Call the stopTransmission() method to stop the transmission.
pause(10)
disp('Transmission started')
Transmission started

Receive the sine wave in the foreground using the receiver System object. Use the isTransmitting function to check if transmission is ongoing. Visualize the received data using the time scope and spectrum analyzer.

if isTransmitting(tx)
    for i = 1:40
        [data, ~] = rx(); 
timeScope(data)
spectrumScope(data)
    end
end

Stop the background transmission.

stopTransmission(tx);
disp('Transmission ended')
Transmission ended

Release the transmitter and receiver System objects.

release(tx);
release(rx);

Input Arguments

collapse all

Transmitter System object, specified as a comm.SDRuTransmitter System object.

Version History

Introduced in R2026a