Acquire Spectral Data from Vector Signal Transceiver Using NI-RFSA Instrument Driver
This example shows how to connect to a simulated NI PXIe-5841 Vector Signal Transceiver (VST) and acquire a finite amount of spectral data from it.
Connect to Instrument
Connect to a simulated VST instrument using the ividev
function. For this example, specify the driver name as niRFSA
, the resource name as PXI1Slot2
, and the IVI driver setup name-value argument as Model:5841
. Alternatively, you can leave the resource name unspecified (""
) for simulated hardware. The driver setup is also optional. If you do not specify a name-value argument for the driver setup, ividev
uses default setup values. For more information about default argument values, see ividev
.
isSimulated =true; if isSimulated dev = ividev("niRFSA", "PXI1Slot2", Simulate=true, DriverSetup="Model:5841") else dev = ividev("niRFSA", "PXI1Slot2") end
dev = niRFSA with properties: Model: "NI PXIe-5841" Manufacturer: "National Instruments" SerialNumber: "" ResourceName: "PXI1Slot2" VendorDriver: "niRFSA" Simulate: 1 ChannelIDs: "0" FIFOEndpointIDs: "FIFOEndpoint0" UserSourceIDs: "usersource0" Vertical: [1x1 Vertical] SignalPath: [1x1 SignalPath] Acquisition: [1x1 Acquisition] Clocking: [1x1 Clocking] Triggers: [1x1 Triggers] Events: [1x1 Events] DeviceCharacteristics: [1x1 DeviceCharacteristics] PeerToPeer: [1x1 PeerToPeer] ConfigurationList: [1x1 ConfigurationList] InherentIVIAttributes: [1x1 InherentIVIAttributes] Deembedding: [1x1 Deembedding] SelfCalibration: [1x1 SelfCalibration] FactoryCalibration: [1x1 FactoryCalibration] ExternalAlignment: [1x1 ExternalAlignment] DeviceSpecific: [1x1 DeviceSpecific] AcquisitionType: IQ Show all functions
Configure Acquisition Properties
Configure the VST to acquire spectral data, centered around a frequency of 1 GHz
, on channel "0
". For single channel devices, you do not need to specify the channel (use ""
). Set the following parameters to the specified value:
Reference clock — onboard clock
Acquisition type — spectrum
Reference level — 0 dB
Start frequency — 990 MHz
Stop frequency — 1010 MHz
Resolution bandwidth — 10 KHz
Explore different options by using tab completion in the Live Editor.
ch = "0"; configureRefClock(dev, "OnboardClock", 1e7); configureAcquisitionType(dev, "SPECTRUM"); configureReferenceLevel(dev, ch, 0); configureSpectrumFrequencyStartStop(dev, ch, 990e6, 1010e6); configureResolutionBandwidth(dev, ch, 10e3);
Acquire Spectrum
Acquire spectral data at the spectral lines determined by the acquisition configuration.
numSpectralLines = dev.Acquisition.Spectrum.NumberOfSpectralLines;
timeout = 10; % sec
[powerSpectrumData, spectrumInfo] = readPowerSpectrumF64(dev, ch, timeout, numSpectralLines);
Plot Spectrum
Construct the frequency values vector using information from the spectrumInfo
structure.
f0 = spectrumInfo.initialFrequency; fincr = spectrumInfo.frequencyIncrement; n = double(spectrumInfo.numberOfSpectralLines); f = f0 + fincr.*(0:n-1);
Display spectral data.
plot(f, powerSpectrumData) axis tight grid minor title("Power Spectrum") xlabel("Frequency(Hz)") ylabel("Power(dBm)")
Clean Up
Disconnect and clear the ividev
object from the workspace.
clear dev
See Also
ividriverlist
| ividevlist
| ividev
Related Topics
- Use NI-RFSA and NI-RFSG Instrument Drivers
- Acquire I/Q Data from Vector Signal Transceiver Using NI-RFSA Instrument Driver
- Generate I/Q Data from Vector Signal Transceiver Using NI-RFSG Instrument Driver
- Generate I/Q Data from Vector Signal Transceiver Using NI-RFSG Scripting
- Acquire Parameterized I/Q Data from Vector Signal Transceiver by Parameter Sweeping