Generate I/Q Data from Vector Signal Transceiver Using NI-RFSG Instrument Driver
This example shows how to connect to a simulated NI™ PXIe-5841 Vector Signal Transceiver (VST) and use it to generate a finite amount of I/Q data.
Connect to Instrument
Connect to a simulated VST instrument using the ividev
function. For this example, specify the driver name as niRFSG
, the resource name as PXI1Slot2
, and the IVI driver setup name-value argument as Model:5841
.
If you do not know your instrument's resource name, you can identify it from the NI Measurement and Automation Explorer (NI MAX) software. 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("niRFSG", "PXI1Slot2", Simulate=true, DriverSetup="Model:5841") else dev = ividev("niRFSG", "PXI1Slot2") end
dev = niRFSG with properties: Model: "NI PXIe-5841" Manufacturer: "National Instruments" SerialNumber: "" ResourceName: "PXI1Slot2" VendorDriver: "niRFSG" Simulate: 1 ChannelIDs: "0" FIFOEndpointIDs: "FIFOEndpoint0" MarkerEventIDs: ["marker0", "marker1", "marker2", "marker3"] ScriptTriggerIDs: ["scripttrigger0", "scripttrigger1", "scripttrigger2", ... ] Arb: [1x1 Arb] Clock: [1x1 Clock] ConfigurationList: [1x1 ConfigurationList] Deembedding: [1x1 Deembedding] DeviceCharacteristics: [1x1 DeviceCharacteristics] DeviceSpecific: [1x1 DeviceSpecific] Events: [1x1 Events] ExternalCalibration: [1x1 ExternalCalibration] InherentIVIAttributes: [1x1 InherentIVIAttributes] IQImpairment: [1x1 IQImpairment] LoadConfigurationsFromFile: [1x1 LoadConfigurationsFromFile] Modulation: [1x1 Modulation] Obsolete: [1x1 Obsolete] PeerToPeer: [1x1 PeerToPeer] RF: [1x1 RF] SelfCalibration: [1x1 SelfCalibration] Triggers: [1x1 Triggers] Show all functions
Configure Generation Properties
Configure the VST to generate I/Q data on channel "0
". For single channel devices, the channel can also be specified as ""
. Set the following parameters to the specified value:
Frequency — 1 GHz
Reference power level — -20 dBm
Generation mode — arbitrary waveform
Arbitrary waveform generator clock frequency — 100 MHz
Signal bandwidth — 100 KHz
Explore different options by using tab completion in the Live Editor.
ch = "0"; configureRF(dev, 1e9, -20); configureGenerationMode(dev, "ARB_WAVEFORM"); dev.Arb.IQRate = 100e6; configureSignalBandwidth(dev, 100e3);
Configure Waveform Data
Configure the VST to generate I/Q data on channel "0
" using writeArbWaveform
. Define I/Q data as a complex 1000-point sinusoidal waveform and write its real and imaginary components to the instrument's buffer using a single operation.
numPoints = 1000;
x = linspace(-pi, pi, numPoints);
data = cos(x) + 1i*sin(x);
moreDataPending = false;
waveformName = "";
writeArbWaveform(dev, waveformName, numPoints, real(data), imag(data), moreDataPending);
Generate I/Q Data
Initiate I/Q data generation on the VST and check its status to see whether it has finished. Then, generate data for approximately 10 seconds or until the VST completes generation, whichever happens first.
initiate(dev); isDone = checkGenerationStatus(dev); count = 1; while ~isDone && count <= 100 isDone = checkGenerationStatus(dev); pause(0.100) count = count+1; end configureOutputEnabled(dev, false);
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 Spectral Data from Vector Signal Transceiver Using NI-RFSA Instrument Driver
- Acquire I/Q Data from Vector Signal Transceiver Using NI-RFSA 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