SA API
|
API functions for the SA44/124 spectrum analyzers. More...
Go to the source code of this file.
Data Structures | |
struct | saSelfTestResults |
struct | saIQPacket |
Macros | |
#define | SA_TRUE (1) |
#define | SA_FALSE (0) |
#define | SA_MAX_DEVICES 8 |
#define | SA44_MIN_FREQ (1.0) |
#define | SA124_MIN_FREQ (100.0e3) |
#define | SA44_MAX_FREQ (4.4e9) |
#define | SA124_MAX_FREQ (13.0e9) |
#define | SA_MIN_SPAN (1.0) |
#define | SA_MAX_REF (20) |
#define | SA_MAX_ATTEN (3) |
#define | SA_MAX_GAIN (2) |
#define | SA_MIN_RBW (0.1) |
#define | SA_MAX_RBW (6.0e6) |
#define | SA_MIN_RT_RBW (100.0) |
#define | SA_MAX_RT_RBW (10000.0) |
#define | SA_MIN_IQ_BANDWIDTH (100.0) |
#define | SA_MAX_IQ_DECIMATION (128) |
#define | SA_IQ_SAMPLE_RATE (486111.111) |
#define | SA_IDLE (-1) |
#define | SA_SWEEPING (0x0) |
#define | SA_REAL_TIME (0x1) |
#define | SA_IQ (0x2) |
#define | SA_AUDIO (0x3) |
#define | SA_TG_SWEEP (0x4) |
#define | SA_RBW_SHAPE_FLATTOP (0x1) |
#define | SA_RBW_SHAPE_CISPR (0x2) |
#define | SA_MIN_MAX (0x0) |
#define | SA_AVERAGE (0x1) |
#define | SA_LOG_SCALE (0x0) |
#define | SA_LIN_SCALE (0x1) |
#define | SA_LOG_FULL_SCALE (0x2) |
#define | SA_LIN_FULL_SCALE (0x3) |
#define | SA_AUTO_ATTEN (-1) |
#define | SA_AUTO_GAIN (-1) |
#define | SA_LOG_UNITS (0x0) |
#define | SA_VOLT_UNITS (0x1) |
#define | SA_POWER_UNITS (0x2) |
#define | SA_BYPASS (0x3) |
#define | SA_AUDIO_AM (0x0) |
#define | SA_AUDIO_FM (0x1) |
#define | SA_AUDIO_USB (0x2) |
#define | SA_AUDIO_LSB (0x3) |
#define | SA_AUDIO_CW (0x4) |
#define | TG_THRU_0DB (0x1) |
#define | TG_THRU_20DB (0x2) |
#define | SA_REF_UNUSED (0) |
#define | SA_REF_INTERNAL_OUT (1) |
#define | SA_REF_EXTERNAL_IN (2) |
Enumerations | |
enum | saDeviceType { saDeviceTypeNone = 0 , saDeviceTypeSA44 = 1 , saDeviceTypeSA44B = 2 , saDeviceTypeSA124A = 3 , saDeviceTypeSA124B = 4 } |
enum | saStatus { saUnknownErr = -666 , saFrequencyRangeErr = -99 , saInvalidDetectorErr = -95 , saInvalidScaleErr = -94 , saBandwidthErr = -91 , saExternalReferenceNotFound = -89 , saLNAErr = -21 , saOvenColdErr = -20 , saInternetErr = -12 , saUSBCommErr = -11 , saTrackingGeneratorNotFound = -10 , saDeviceNotIdleErr = -9 , saDeviceNotFoundErr = -8 , saInvalidModeErr = -7 , saNotConfiguredErr = -6 , saTooManyDevicesErr = -5 , saInvalidParameterErr = -4 , saDeviceNotOpenErr = -3 , saInvalidDeviceErr = -2 , saNullPtrErr = -1 , saNoError = 0 , saNoCorrections = 1 , saCompressionWarning = 2 , saParameterClamped = 3 , saBandwidthClamped = 4 , saCalFilePermissions = 5 } |
Functions | |
SA_API saStatus | saGetSerialNumberList (int serialNumbers[8], int *deviceCount) |
SA_API saStatus | saOpenDeviceBySerialNumber (int *device, int serialNumber) |
SA_API saStatus | saOpenDevice (int *device) |
SA_API saStatus | saCloseDevice (int device) |
SA_API saStatus | saPreset (int device) |
SA_API saStatus | saSetCalFilePath (const char *path) |
SA_API saStatus | saGetSerialNumber (int device, int *serial) |
SA_API saStatus | saGetFirmwareString (int device, char firmwareString[16]) |
SA_API saStatus | saGetDeviceType (int device, saDeviceType *device_type) |
SA_API saStatus | saConfigAcquisition (int device, int detector, int scale) |
SA_API saStatus | saConfigCenterSpan (int device, double center, double span) |
SA_API saStatus | saConfigLevel (int device, double ref) |
SA_API saStatus | saConfigGainAtten (int device, int atten, int gain, bool preAmp) |
SA_API saStatus | saConfigSweepCoupling (int device, double rbw, double vbw, bool reject) |
SA_API saStatus | saConfigRBWShape (int device, int rbwShape) |
SA_API saStatus | saConfigProcUnits (int device, int units) |
SA_API saStatus | saConfigIQ (int device, int decimation, double bandwidth) |
SA_API saStatus | saConfigAudio (int device, int audioType, double centerFreq, double bandwidth, double audioLowPassFreq, double audioHighPassFreq, double fmDeemphasis) |
SA_API saStatus | saConfigRealTime (int device, double frameScale, int frameRate) |
SA_API saStatus | saConfigRealTimeOverlap (int device, double advanceRate) |
SA_API saStatus | saSetTimebase (int device, int timebase) |
SA_API saStatus | saInitiate (int device, int mode, int flag) |
SA_API saStatus | saAbort (int device) |
SA_API saStatus | saQuerySweepInfo (int device, int *sweepLength, double *startFreq, double *binSize) |
SA_API saStatus | saQueryStreamInfo (int device, int *returnLen, double *bandwidth, double *samplesPerSecond) |
SA_API saStatus | saQueryRealTimeFrameInfo (int device, int *frameWidth, int *frameHeight) |
SA_API saStatus | saQueryRealTimePoi (int device, double *poi) |
SA_API saStatus | saGetSweep_32f (int device, float *min, float *max) |
SA_API saStatus | saGetSweep_64f (int device, double *min, double *max) |
SA_API saStatus | saGetPartialSweep_32f (int device, float *min, float *max, int *start, int *stop) |
SA_API saStatus | saGetPartialSweep_64f (int device, double *min, double *max, int *start, int *stop) |
SA_API saStatus | saGetRealTimeFrame (int device, float *minSweep, float *maxSweep, float *colorFrame, float *alphaFrame) |
SA_API saStatus | saGetIQ_32f (int device, float *iq) |
SA_API saStatus | saGetIQ_64f (int device, double *iq) |
SA_API saStatus | saGetIQData (int device, saIQPacket *pkt) |
SA_API saStatus | saGetIQDataUnpacked (int device, float *iqData, int iqCount, int purge, int *dataRemaining, int *sampleLoss, int *sec, int *milli) |
SA_API saStatus | saGetAudio (int device, float *audio) |
SA_API saStatus | saQueryTemperature (int device, float *temp) |
SA_API saStatus | saQueryDiagnostics (int device, float *voltage) |
SA_API saStatus | saAttachTg (int device) |
SA_API saStatus | saIsTgAttached (int device, bool *attached) |
SA_API saStatus | saConfigTgSweep (int device, int sweepSize, bool highDynamicRange, bool passiveDevice) |
SA_API saStatus | saStoreTgThru (int device, int flag) |
SA_API saStatus | saSetTg (int device, double frequency, double amplitude) |
SA_API saStatus | saSetTgReference (int device, int reference) |
SA_API saStatus | saGetTgFreqAmpl (int device, double *frequency, double *amplitude) |
SA_API saStatus | saConfigIFOutput (int device, double inputFreq, double outputFreq, int inputAtten, int outputGain) |
SA_API saStatus | saSelfTest (int device, saSelfTestResults *results) |
SA_API const char * | saGetAPIVersion () |
SA_API const char * | saGetProductID () |
SA_API const char * | saGetErrorString (saStatus code) |
API functions for the SA44/124 spectrum analyzers.
This is the main file for user accessible functions for controlling the SA44 and SA124 spectrum analyzers.
#define SA_TRUE (1) |
Used for boolean true when integer parameters are being used.
#define SA_FALSE (0) |
Used for boolean false when integer parameters are being used.
#define SA_MAX_DEVICES 8 |
Maximum number of devices that can be interfaced in the API. See saGetSerialNumberList.
#define SA44_MIN_FREQ (1.0) |
Minimum frequency (Hz) for sweeps, and minimum center frequency for I/Q measurements for SA44 devices. See saConfigCenterSpan.
#define SA124_MIN_FREQ (100.0e3) |
Minimum frequency (Hz) for sweeps, and minimum center frequency for I/Q measurements for SA124 devices. See saConfigCenterSpan.
#define SA44_MAX_FREQ (4.4e9) |
Maximum frequency (Hz) for sweeps, and maximum center frequency for I/Q measurements for SA44 devices. See saConfigCenterSpan.
#define SA124_MAX_FREQ (13.0e9) |
Maximum frequency (Hz) for sweeps, and maximum center frequency for I/Q measurements for SA124 devices. See saConfigCenterSpan.
#define SA_MIN_SPAN (1.0) |
Minimum span (Hz) for sweeps. See saConfigCenterSpan.
#define SA_MAX_REF (20) |
Maximum reference level in dBm. See saConfigLevel.
#define SA_MAX_ATTEN (3) |
Maximum attentuation. Valid values [0,3] or -1 for auto. See saConfigGainAtten.
#define SA_MAX_GAIN (2) |
Maximum gain. Valid values [0,2] or -1 for auto. See saConfigGainAtten.
#define SA_MIN_RBW (0.1) |
Minimum RBW (Hz) for sweeps. See saConfigSweepCoupling.
#define SA_MAX_RBW (6.0e6) |
Maximum RBW (Hz) for sweeps. See saConfigSweepCoupling.
#define SA_MIN_RT_RBW (100.0) |
Minimum RBW (Hz) for device configured in real-time measurement mode. See saConfigSweepCoupling.
#define SA_MAX_RT_RBW (10000.0) |
Maximum RBW (Hz) for device configured in real-time measurement mode. See saConfigSweepCoupling.
#define SA_MIN_IQ_BANDWIDTH (100.0) |
Minimum I/Q bandwidth (Hz). See saConfigIQ.
#define SA_MAX_IQ_DECIMATION (128) |
Maximum I/Q bandwidth (Hz). See saConfigIQ.
#define SA_IQ_SAMPLE_RATE (486111.111) |
Base I/Q sample rate in Hz. See saConfigIQ.
#define SA_IDLE (-1) |
Measurement mode: Idle, no measurement. See saInitiate.
#define SA_SWEEPING (0x0) |
Measurement mode: Swept spectrum analysis. See saInitiate.
#define SA_REAL_TIME (0x1) |
Measurement mode: Real-time spectrum analysis. See saInitiate.
#define SA_IQ (0x2) |
Measurement mode: I/Q streaming. See saInitiate.
#define SA_AUDIO (0x3) |
Measurement mode: Audio demod. See saInitiate.
#define SA_TG_SWEEP (0x4) |
Measurement mode: Tracking generator sweeps for scalar network analysis. See saInitiate.
#define SA_RBW_SHAPE_FLATTOP (0x1) |
Specifies the Stanford flattop window used for sweep and real-time analysis. See saConfigRBWShape.
#define SA_RBW_SHAPE_CISPR (0x2) |
Specifies a Gaussian window with 6dB cutoff used for sweep and real-time analysis. See saConfigRBWShape.
#define SA_MIN_MAX (0x0) |
Use min/max detector for sweep and real-time spectrum analysis. See saConfigAcquisition.
#define SA_AVERAGE (0x1) |
Use average detector for sweep and real-time spectrum analysis. See saConfigAcquisition.
#define SA_LOG_SCALE (0x0) |
Specifies dBm units of sweep and real-time spectrum analysis measurements. See saConfigAcquisition.
#define SA_LIN_SCALE (0x1) |
Specifies mV units of sweep and real-time spectrum analysis measurements. See saConfigAcquisition.
#define SA_LOG_FULL_SCALE (0x2) |
Specifies dBm units, with no corrections, of sweep and real-time spectrum analysis measurements. See saConfigAcquisition.
#define SA_LIN_FULL_SCALE (0x3) |
Specifies mV units, with no corrections, of sweep and real-time spectrum analysis measurements. See saConfigAcquisition.
#define SA_AUTO_ATTEN (-1) |
Automatically choose attenuation based on reference level. See saConfigGainAtten.
#define SA_AUTO_GAIN (-1) |
Automatically choose gain based on reference level. See saConfigGainAtten.
#define SA_LOG_UNITS (0x0) |
VBW processing occurs in dBm. See saConfigProcUnits.
#define SA_VOLT_UNITS (0x1) |
VBW processing occurs in linear voltage units (mV). See saConfigProcUnits.
#define SA_POWER_UNITS (0x2) |
VBW processing occurs in linear power units (mW). See saConfigProcUnits.
#define SA_BYPASS (0x3) |
No VBW processing. See saConfigProcUnits.
#define SA_AUDIO_AM (0x0) |
Audio demodulation type: AM. See saConfigAudio.
#define SA_AUDIO_FM (0x1) |
Audio demodulation type: FM. See saConfigAudio.
#define SA_AUDIO_USB (0x2) |
Audio demodulation type: Upper side band. See saConfigAudio.
#define SA_AUDIO_LSB (0x3) |
Audio demodulation type: Lower side band. See saConfigAudio.
#define SA_AUDIO_CW (0x4) |
Audio demodulation type: CW. See saConfigAudio.
#define TG_THRU_0DB (0x1) |
In scalar network analysis, use the next trace as a thru. See saStoreTgThru.
#define TG_THRU_20DB (0x2) |
In scalar network analysis, improve accuracy with a second thru step. See saStoreTgThru.
#define SA_REF_UNUSED (0) |
Additional corrections are applied to tracking generator timebase. See saSetTgReference.
#define SA_REF_INTERNAL_OUT (1) |
Use tracking generator timebase as frequency standard for system, and do not apply additional corrections. See saSetTgReference.
#define SA_REF_EXTERNAL_IN (2) |
Use an external reference for TG124A, and do not apply additional corrections to timebase. See saSetTgReference.
enum saDeviceType |
enum saStatus |
Status code returned from all SA API functions. Errors are negative and suffixed with 'Err'. Errors stop the flow of execution, warnings do not.
SA_API saStatus saGetSerialNumberList | ( | int | serialNumbers[8], |
int * | deviceCount | ||
) |
This function returns the devices that are unopened in the current process. Up to SA_MAX_DEVICES devices will be returned. The serial numbers of the unopened devices are returned. The provided array will be populated starting at index 0. The integer pointed to by deviceCount will equal the number of devices reported by this function upon returning.
[out] | serialNumbers | A pointer to an array of at minimum SA_MAX_DEVICES contiguous 32-bit integers. It is undefined behavior if the array pointed to by serialNumbers is not SA_MAX_DEVICES integers in length. |
[out] | deviceCount | Pointer to an integer. Will be set to the number of devices found on the system. |
SA_API saStatus saOpenDeviceBySerialNumber | ( | int * | device, |
int | serialNumber | ||
) |
This function is similar to saOpenDevice except you can specify the serial number of the device you wish to open. Everything else is identical.
[out] | device | Pointer to 32-bit integer variable. If this function returns successfully, the value device points to will contain a unique handle value to the device opened. This number is used for all successive API function calls. |
[in] | serialNumber | User-provided serial number. |
SA_API saStatus saOpenDevice | ( | int * | device | ) |
This function attempts to open the first SA44/SA124 it detects. If a device is opened successfully, a handle to the device will be returned through the device pointer which can be used to target that device for other API calls.
When successful, this function takes about 5 seconds to perform. If it is the first time a device is opened on a host PC, this function can potentially take much longer. See First Time Opening a New Device.
[out] | device | Pointer to 32-bit integer variable. If this function returns successfully, the value device points to will contain a unique handle value to the device opened. This number is used for all successive API function calls. |
SA_API saStatus saCloseDevice | ( | int | device | ) |
This function is called when you wish to terminate a connection with a device. Any resources the device has allocated will be freed and the USB 2.0 connection to the device is terminated. The device closed will be released and will become available to be opened again. Any activity the device is performing is aborted automatically before closing.
[in] | device | Device handle. |
SA_API saStatus saPreset | ( | int | device | ) |
This function exists to invoke a hard reset of the device. This will function similarly to a power cycle (unplug/re-connect the device). This might be useful if the device has entered an undesirable or unrecoverable state. This function might allow the software to perform the reset rather than ask the user to perform a power cycle.
Functionally, in addition to a hard reset, this function closes the device as if saCloseDevice was called. This means the device handle becomes invalid and the device must be reopened for use.
This function is a blocking call and takes about 2.5 seconds to return.
[in] | device | Device handle. |
SA_API saStatus saSetCalFilePath | ( | const char * | path | ) |
This function should be called before opening the device. Ideally it should be the first function called in a program interfacing the device. The path specified should be suffixed with the ‘/’ or ‘\’ character, denoting that it is a directory. Failure to append a slash character will result in undesired behavior.
See examples of usage below.
When a device is opened, the API will look in the supplied path for the required calibration files. If the folder does not exist, it will be created. If the files do not exist in the folder, they will be acquired from the device flash memory where applicable, and for all other devices downloaded from the Signal Hound web server. The files will be placed in the supplied directory for future use. If the files exist in the directory, they will simply be loaded into memory.
This function does not need to be called, as it will use a default system path, typically C:/ProgramData/SignalHound/cal_files/
.
To set the working directory as the calibration file path call the function as saSetCalFilePath(“.\\”);
To set an absolute path, you might call the function as saSetCalFilePath(“C:\\ProgramData\\SignalHound\\CalFiles\\”);
[in] | path |
SA_API saStatus saGetSerialNumber | ( | int | device, |
int * | serial | ||
) |
This function may be called only after the device has been opened. The serial number returned should match the number on the case.
[in] | device | Device handle. |
[out] | serial | Pointer to a 32-bit integer which will be assigned the serial number of the device specified. |
SA_API saStatus saGetFirmwareString | ( | int | device, |
char | firmwareString[16] | ||
) |
Use this function to determine the firmware version of a specified device.
[in] | device | Device handle. |
[out] | firmwareString | Pointer to a char array. The array should be at minimum 16 chars in length. |
SA_API saStatus saGetDeviceType | ( | int | device, |
saDeviceType * | device_type | ||
) |
This function may be called only after the device has been opened. If the device handle is valid, type will contain the model type of the device pointed to by the handle. type is an enumerated value of type saDeviceType.
[in] | device | Device handle. |
[out] | device_type | Pointer to an integer to receive the model type. |
SA_API saStatus saConfigAcquisition | ( | int | device, |
int | detector, | ||
int | scale | ||
) |
detector specifies how to produce the results of the signal processing for the final sweep. Depending on settings, potentially many overlapping FFTs will be performed on the input time domain data to retrieve a more consistent and accurate final result. When the results overlap detector chooses whether to average the results together, or maintain the minimum and maximum values. If averaging is chosen, the min and max sweep arrays will contain the same averaged data.
The scale parameter will change the units of returned sweeps. If SA_LOG_SCALE is provided sweeps will be returned in amplitude unit dBm. If SA_LIN_SCALE, the returned units will be in millivolts. If the full scale units are specified, no corrections are applied to the data and amplitudes are taken directly from the full scale input
[in] | device | Device handle. |
[in] | detector | Specifies the video detector. The two possible values are SA_MIN_MAX and SA_AVERAGE |
[in] | scale | Specifies the scale in which sweep results are returned. The four possible values are SA_LOG_SCALE, SA_LIN_SCALE, SA_LOG_FULL_SCALE, and SA_LIN_FULL_SCALE. |
SA_API saStatus saConfigCenterSpan | ( | int | device, |
double | center, | ||
double | span | ||
) |
This function configures the operating frequency band of the device. Start and stop frequencies can be determined from the center and span.
start = center – (span / 2)
stop = center + (span / 2)
The values provided are used by the device during initialization and a more precise start frequency is returned after initiation. Refer to saQuerySweepInfo for more information.
Each device has a specified operational frequency range between some minimum and maximum frequency. The limits are defined by SA44_MIN_FREQ, SA124_MIN_FREQ, SA44_MAX_FREQ, and SA124_MAX_FREQ. The center and span provided cannot specify a sweep outside of this range. Certain modes of operation have specific frequency range limits. Those mode-dependent limits are tested against during saInitiate and not here.
[in] | device | Device handle. |
[in] | center | Center frequency in hertz. |
[in] | span | Span in hertz. |
SA_API saStatus saConfigLevel | ( | int | device, |
double | ref | ||
) |
This function is best utilized when the device attenuation and gain are set to automatic (default). When both attenuation and gain are set to SA_AUTO_ATTEN and SA_AUTO_GAIN, respectively, the API uses the reference level to best choose the gain and attenuation for maximum dynamic range. The API chooses attenuation and gain values best for analyzing signal at or below the reference level. For this reason, to achieve the best results, use auto gain and atten, and set your reference level at or slightly about your expected input power for best sensitivity. Reference level is specified in dBm units.
[in] | device | Device handle. |
[in] | ref | Reference level in dBm. |
SA_API saStatus saConfigGainAtten | ( | int | device, |
int | atten, | ||
int | gain, | ||
bool | preAmp | ||
) |
To set attenuation or gain to automatic, pass SA_AUTO_GAIN and SA_AUTO_ATTEN as parameters. The preamp parameter is ignored when gain and attenuation are automatic and is chosen automatically.
Supplied Parameter | SA44 Attenuation | SA124 Attenuation |
---|---|---|
SA_AUTO_ATTEN (-1) | Auto | Auto |
0 | 0 dB | 0 dB |
1 | 5 dB | 10 dB |
2 | 10 dB | 20 dB |
3 | 15 dB | 30 dB |
Supplied Parameter | Gain |
---|---|
SA_AUTO_GAIN (-1) | Auto |
0 | 16 dB Attenuation |
1 | Mid-Range |
2 | 12 dB Digital Gain |
By default, if this function is not called, gain and attenuation are set to automatic. It is suggested to leave these values as automatic as it will greatly increase the consistency of your results. If you choose to manually control gain and attenuation please read Setting Gain and Attenuation.
[in] | device | Device handle. |
[in] | atten | Attenuator setting. |
[in] | gain | Gain setting. |
[in] | preAmp | Specify whether to enable the internal device pre-amplifier. |
SA_API saStatus saConfigSweepCoupling | ( | int | device, |
double | rbw, | ||
double | vbw, | ||
bool | reject | ||
) |
The resolution bandwidth, or RBW, represents the bandwidth of spectral energy represented in each frequency bin. For example, with an RBW of 10 kHz, the amplitude value for each bin would represent the total energy from 5 kHz below to 5 kHz above the bin’s center.
The video bandwidth, or VBW, is applied after the signal has been converted to frequency domain as power, voltage, or log units. It is implemented as a simple rectangular window, averaging the amplitude readings for each frequency bin over several overlapping FFTs. A signal whose amplitude is modulated at a much higher frequency than the VBW will be shown as an average, whereas amplitude modulation at a lower frequency will be shown as a minimum and maximum value.
Available RBWs are [0.1Hz – 100kHz] and 250kHz. For the SA124 devices, a 6MHz RBW is available as well. Not all RBWs will be available depending on span, for example the API may restrict RBW when a sweep size exceeds a certain amount. Also there are many hardware limitations that restrict certain RBWs, for a full list of these restrictions, see Setting RBW and VBW.
The parameter reject determines whether software image reject will be performed. The SA series spectrum analyzers do not have hardware-based image rejection, instead relying on a software algorithm to reject image responses. See the SA44B User Manual or SA124B User Manual for additional details. Generally, set reject to true for continuous signals, and false to catch short duration signals at a known frequency. To capture short duration signals with an unknown frequency, consider the Signal Hound BB60C, BB60D, SM200B, SM200C, or SM435B spectrum analyzers.
[in] | device | Device handle. |
[in] | rbw | Resolution bandwidth in Hz. RBW can be arbitrary. |
[in] | vbw | Video bandwidth in Hz. VBW must be less than or equal to RBW. VBW can be arbitrary. For best performance use RBW as the VBW. |
[in] | reject | Indicates whether to enable image rejection. |
SA_API saStatus saConfigRBWShape | ( | int | device, |
int | rbwShape | ||
) |
Specify the RBW filter shape, which is achieved by changing the window function. When specifying SA_RBW_SHAPE_FLATTOP, a custom bandwidth flat-top window is used measured at the 3dB cutoff point. When specifying SA_RBW_SHAPE_CISPR, a Gaussian window with zero-padding is used to achieve the specified RBW. The Gaussian window is measured at the 6dB cutoff point.
[in] | device | Device handle. |
[in] | rbwShape | An acceptable RBW filter shape value, either SA_RBW_SHAPE_FLATTOP or SA_RBW_SHAPE_CISPR. |
SA_API saStatus saConfigProcUnits | ( | int | device, |
int | units | ||
) |
The units provided determines what unit type video processing occurs in. The chart below shows which unit types are used for each units selection.
For “average power” measurements, SA_POWER_UNITS should be selected. For cleaning up an amplitude modulated signal, SA_VOLT_UNITS would be a good choice. To emulate a traditional spectrum analyzer, select SA_LOG_UNITS. To minimize processing power and bypass video bandwidth processing, select SA_BYPASS.
Macro | Unit |
---|---|
SA_LOG_UNITS | dBm |
SA_VOLT_UNITS | mV |
SA_POWER_UNITS | mW |
SA_BYPASS | No video processing |
[in] | device | Device handle. |
[in] | units | The possible values are SA_POWER_UNITS, SA_LOG_UNITS, SA_VOLT_UNITS, and SA_BYPASS. |
SA_API saStatus saConfigIQ | ( | int | device, |
int | decimation, | ||
double | bandwidth | ||
) |
This function is used to configure the digital I/Q data stream. A decimation factor and filter bandwidth are able to be specified. The decimation rate divides the I/Q sample rate directly while the bandwidth parameter further filters the digital stream.
For any given decimation rate, a minimum filter bandwidth must be applied to account for sufficient filter roll off. If a bandwidth value is supplied above the maximum for a given decimation, the bandwidth will be clamped to the maximum value. For a list of possible decimation values and associated bandwidth values, see the table below.
The base sample rate of the SA44 and SA124 spectrum analyzers is 486.111111 (repeating) kS/s. To get a precise sample rate given a decimation value, use this equation.
sample rate = 486111.11111~ / decimation
Decimation Rate | Maximum Bandwidth |
---|---|
1 | 250.0 kHz |
2 | 225.0 kHz |
4 | 100.0 kHz |
8 | 50.0 kHz |
16 | 20 kHz |
32 | 12.0 kHz |
64 | 5.0 kHz |
128 | 3.0 kHz |
[in] | device | Device handle. |
[in] | decimation | Specify a decimation rate for the I/Q data stream. |
[in] | bandwidth | Specify the band pass filter width on the I/Q digital stream. |
SA_API saStatus saConfigAudio | ( | int | device, |
int | audioType, | ||
double | centerFreq, | ||
double | bandwidth, | ||
double | audioLowPassFreq, | ||
double | audioHighPassFreq, | ||
double | fmDeemphasis | ||
) |
This function is used to configure the majority of the audio stream settings. A number of audio modulation types are supported, and a number of filter parameters can be set.
Below is the overall flow of data through our audio processing algorithm:
[in] | device | Device handle. |
audioType | Specifies the demodulation scheme, possible values are SA_AUDIO_AM, SA_AUDIO_FM, SA_AUDIO_USB, SA_AUDIO_LSB, and SA_AUDIO_CW. | |
centerFreq | Center frequency in Hz of audio signal to demodulate. | |
bandwidth | Intermediate frequency bandwidth centered on freq. Filter takes place before demodulation. Specified in Hz. Should be between 500Hz and 500kHz. | |
audioLowPassFreq | Post demodulation filter in Hz. Should be between 1kHz and 12kHz. | |
audioHighPassFreq | Post demodulation filter in Hz. Should be between 20 and 1000Hz. | |
fmDeemphasis | Specified in microseconds. Should be between 1 and 100. This value is ignored if audioType is not equal to SA_AUDIO_FM. |
SA_API saStatus saConfigRealTime | ( | int | device, |
double | frameScale, | ||
int | frameRate | ||
) |
The function allows you to configure additional parameters of the real-time frames returned from the API. If this function is not called a scale of 100dB is used and a frame rate of 30fps is used. For more information regarding real-time mode see Real-Time Spectrum Analysis.
[in] | device | Device handle. |
[in] | frameScale | Specify the real-time frame height in dB. Values can be between [10 - 200]. |
[in] | frameRate | Specify the real-time frame rate in frames per seconds. Values can be between [4 – 30]. |
SA_API saStatus saConfigRealTimeOverlap | ( | int | device, |
double | advanceRate | ||
) |
By setting the advance rate users can control the overlap rate of the FFT processing in real-time spectrum analysis. The advanceRate parameter specifies how far the FFT window slides through the data for each FFT as a function of FFT size. An advanceRate of 0.5 specifies that the FFT window will advance 50% the FFT length for each FFT for a 50% overlap rate. Specifying a value of 1.0 would mean the FFT window advances the full FFT length meaning there is no overlap in real-time processing. The default value is 0.125 and the range of acceptable values is between [0.125, 10]. Increasing the advance rate reduces processing considerably but also increases the 100% probability of intercept of the device.
[in] | device | Device handle. |
[in] | advanceRate | FFT advance rate. See description. |
SA_API saStatus saSetTimebase | ( | int | device, |
int | timebase | ||
) |
Configure the time base reference port for the device. By passing a value of SA_REF_INTERNAL_OUT you can output the internal 10MHz time base of the device out on the reference port. By passing a value of SA_REF_EXTERNAL_IN the API attempts to enable a 10MHz reference on the reference BNC port. If no reference is found, the device continues to use the internal reference clock. Once a device has successfully switched to an external reference it must remain using it until the device is closed, and it is undefined behavior to disconnect the reference input from the reference BNC port.
[in] | device | Device handle. |
[in] | timebase | Time base setting value. Acceptable inputs are SA_REF_INTERNAL_OUT and SA_REF_EXTERNAL_IN. |
SA_API saStatus saInitiate | ( | int | device, |
int | mode, | ||
int | flag | ||
) |
This function configures the device into a state determined by the mode parameter. For more information regarding operating states, refer to the Theory of Operation and Modes of Operation sections. This function calls saAbort before attempting to reconfigure. It should be noted, if an error occurs attempting to configure the device, any past operating state will no longer be active and the device will become idle.
[in] | device | Device handle. |
[in] | mode | The possible values for mode are SA_IDLE, SA_SWEEPING, SA_REAL_TIME, SA_IQ, SA_AUDIO, and SA_TG_SWEEP. |
[in] | flag | This value is currently unused. Pass 0 as a parameter. |
SA_API saStatus saAbort | ( | int | device | ) |
Stops the device operation and places the device into an idle state. If the device is currently idle, then the function returns normally and returns saNoError.
[in] | device | Device handle. |
SA_API saStatus saQuerySweepInfo | ( | int | device, |
int * | sweepLength, | ||
double * | startFreq, | ||
double * | binSize | ||
) |
This function should be called to determine sweep characteristics after a device has been configured and initiated.
[in] | device | Device handle. |
[out] | sweepLength | A pointer to a 32-bit integer. If the function returns successfully, the integer pointed to will contain the size of the min and max arrays returned by saGetSweep_32f and saGetSweep_64f. |
[out] | startFreq | A pointer to a 64-bit floating point variable. If the function returns successfully, the variable startFreq points to will equal the frequency of the first bin in the configured sweep. |
[out] | binSize | A pointer to a 64-bit floating point variable. If the function returns successfully, the variable binSize points to will contain the frequency difference between each bin in the configured sweep. |
SA_API saStatus saQueryStreamInfo | ( | int | device, |
int * | returnLen, | ||
double * | bandwidth, | ||
double * | samplesPerSecond | ||
) |
Use this function to get the parameters of the I/Q data stream.
[in] | device | Device handle. |
[out] | returnLen | Pointer to a 32-bit integer. If the function returns successfully, the variable returnLen points to will contain the number of I/Q sample pairs that will be returned by calling saGetIQ_32f/saGetIQ_64f. |
[out] | bandwidth | Pointer to a 64-bit float. If the function returns successfully, the variable bandwidth points to will contain the bandpass filter bandwidth width in Hz. Width is specified by the 3dB roll-off points. |
[out] | samplesPerSecond | Pointer to a 32-bit integer. If the function returns successfully, the variable samplesPerSecond points to will contain the sample rate of the configured I/Q data stream. |
SA_API saStatus saQueryRealTimeFrameInfo | ( | int | device, |
int * | frameWidth, | ||
int * | frameHeight | ||
) |
This function should be called after initializing the device for real-time mode. This device returns the frame size of the real-time frame configured.
[in] | device | Device handle. |
[out] | frameWidth | Pointer to a 32-bit signed integer representing the width of the real-time frame. |
[out] | frameHeight | Pointer to a 32-bit signed integer representing the height of the real-time frame. |
SA_API saStatus saQueryRealTimePoi | ( | int | device, |
double * | poi | ||
) |
When this function returns successfully, the value poi points to will contain the 100% probability of intercept duration in seconds of the device as currently configured in real-time spectrum analysis. The device must actively be configured and initialized in the real-time spectrum analysis mode.
[in] | device | Device handle. |
[out] | poi | Pointer to double. See description. |
SA_API saStatus saGetSweep_32f | ( | int | device, |
float * | min, | ||
float * | max | ||
) |
Upon returning successfully, this function returns the minimum and maximum floating point arrays of one full sweep. If the detector provided in saConfigAcquisition is SA_AVERAGE, the arrays will be populated with the same values. Element zero of each array corresponds to the startFreq returned from saQuerySweepInfo.
[in] | device | Device handle. |
[out] | min | Pointer to the beginning of an array of 32-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. |
[out] | max | Pointer to the beginning of an array of 32-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. |
SA_API saStatus saGetSweep_64f | ( | int | device, |
double * | min, | ||
double * | max | ||
) |
See saGetSweep_32f.
[in] | device | Device handle. |
[out] | min | Pointer to the beginning of an array of 64-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. |
[out] | max | Pointer to the beginning of an array of 64-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. |
SA_API saStatus saGetPartialSweep_32f | ( | int | device, |
float * | min, | ||
float * | max, | ||
int * | start, | ||
int * | stop | ||
) |
This function is similar to the saGetSweep_32f/saGetSweep_64f functions except it can return in certain contexts before the full sweep is ready. This function might return for sweeps which are going to take multiple seconds, providing you with only a portion of the results. This might be useful if you want to perform some signal analysis on portions of the sweep as it is being received, or update other portions of your application during a long acquisition process. Subsequent calls will always provide the next contiguous portion of spectrum.
A buffer that can hold the full sweep must be provided. The pointers start and stop are used to determine which portion of the sweep was updated. The elements in the arrays from [start, stop] will be updated. start and _stop_ - 1
can be used to index the updated portion of the arrays.
The updated portion of the sweep will always at maximum end at the final element of the sweep. For example, if only 20 frequency bins remain after the previous call to saGetPartialSweep_32f/saGetPartialSweep_32f, the next call will update at most 20 points. When the final portion of the sweep has been updated, stop will equal the sweep length. Calling this function again will request and begin the next sweep.
[in] | device | Device handle. |
min | Pointer to an array of 32-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. | |
max | Pointer to an array of 32-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. | |
start | Pointer to a 32-bit integer variable. If the function returns successfully, the variable start points to will contain the start index of the updated portion of the sweep. | |
stop | Pointer to a 32-bit integer variable. If the function returns successfully, the variable stop points to will contain the index + 1 of the last update value in the updated portion of the sweep. |
SA_API saStatus saGetPartialSweep_64f | ( | int | device, |
double * | min, | ||
double * | max, | ||
int * | start, | ||
int * | stop | ||
) |
[in] | device | Device handle. |
min | Pointer to an array of 64-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. | |
max | Pointer to an array of 64-bit floating point values, whose length is equal to or greater than sweepLength returned from saQuerySweepInfo. | |
start | Pointer to a 32-bit integer variable. If the function returns successfully, the variable start points to will contain the start index of the updated portion of the sweep. | |
stop | Pointer to a 32-bit integer variable. If the function returns successfully, the variable stop points to will contain the index + 1 of the last update value in the updated portion of the sweep. |
SA_API saStatus saGetRealTimeFrame | ( | int | device, |
float * | minSweep, | ||
float * | maxSweep, | ||
float * | colorFrame, | ||
float * | alphaFrame | ||
) |
This function is used to retrieve the real-time sweeps, frame, and alpha frame for a measurement interval. This function should be used instead of saGetSweep_32f/saGetSweep_64f and saGetPartialSweep_32f/saGetPartialSweep_64f for real-time mode. The sweep array should be ‘N’ contiguous floats, where N is the sweep length returned from saQuerySweepInfo. The frame and alphaFrame should be WxH values long where W and H are the values returned from saQueryRealTimeFrameInfo. For more information see Real-Time Spectrum Analysis.
[in] | device | Device handle. |
[out] | minSweep | If this pointer is non-null, the min held sweep will be returned to the user. If the detector is set to average, this array will be identical to the maxSweep array returned. |
[out] | maxSweep | If this pointer is non-null, the max held sweep will be returned to the user. If the detector is set to average, this array contains the averaged results over the measurement interval. |
[out] | colorFrame | Pointer to a 32-bit floating point array. If the function returns successfully, the contents of the array will contain a single real-time frame. |
[out] | alphaFrame | Pointer to a 32-bit floating point array. If the function returns successfully, the contents of the array will contain a single real-time alpha frame. |
SA_API saStatus saGetIQ_32f | ( | int | device, |
float * | iq | ||
) |
Retrieve the next array of I/Q samples in the stream. The length of the buffer provided to this function is the return length from saQueryStreamInfo * 2. saQueryStreamInfo returns the length as I/Q sample pairs. This function will need to be called ~30 times per second for any given decimation rate for the internal circular buffers not to fall behind. We recommend polling this function from a separate thread and not performing any other tasks on the polling thread to ensure the thread does not fall behind.
The buffer will be populated with alternating I/Q sample pairs scaled to mW. The time difference between each sample can be determined from the sample rate of the configured device.
[in] | device | Device handle. |
[out] | iq | A pointer to a 32-bit floating point array. The contents of this buffer will be updated with interleaved I/Q digital samples. |
SA_API saStatus saGetIQ_64f | ( | int | device, |
double * | iq | ||
) |
See saGetIQ_32f.
[in] | device | Device handle. |
[out] | iq | A pointer to a 64-bit floating point array. The contents of this buffer will be updated with interleaved I/Q digital samples. |
SA_API saStatus saGetIQData | ( | int | device, |
saIQPacket * | pkt | ||
) |
This function retrieves one block of I/Q data as specified by the saIQPacket struct.
[in] | device | Device handle. |
[out] | pkt | Pointer to a saIQPacket struct. |
SA_API saStatus saGetIQDataUnpacked | ( | int | device, |
float * | iqData, | ||
int | iqCount, | ||
int | purge, | ||
int * | dataRemaining, | ||
int * | sampleLoss, | ||
int * | sec, | ||
int * | milli | ||
) |
This function provides an alternate interface to the saGetIQData function. Using this function, you can eliminate the need for the saIQPacket struct, which eases development of non-C programming language bindings (languages and environments such as LabVIEW, MATLAB, Python, C#, etc).
The parameters to this function have a one-to-one mapping to the members of the saIQPacket struct.
This function is implemented by populating the saIQPacket struct with the provided parameters and calling saGetIQData.
[in] | device | Device handle. |
[out] | iqData | See saIQPacket. |
[out] | iqCount | See saIQPacket. |
[out] | purge | See saIQPacket. |
[out] | dataRemaining | See saIQPacket. |
[out] | sampleLoss | See saIQPacket. |
[out] | sec | See saIQPacket. |
[out] | milli | See saIQPacket. |
SA_API saStatus saGetAudio | ( | int | device, |
float * | audio | ||
) |
If the device is initiated and running in the audio demodulation mode, the function is a blocking call which returns the next 4096 audio samples. The approximate blocking time for this function is 128 ms if called again immediately after returning. There is no internal buffering of audio, meaning the audio will be overwritten if this function is not called in a timely fashion. The audio values are typically -1.0 to 1.0, representing full-scale audio. In FM mode, the audio values will scale with a change in IF bandwidth.
[in] | device | Device handle. |
[out] | audio | Pointer to a 32-bit floating point value array. |
SA_API saStatus saQueryTemperature | ( | int | device, |
float * | temp | ||
) |
Requesting the internal temperature of the device cannot be performed while the device is currently active. To receive the absolute current internal device temperature, ensure the device is inactive by calling saAbort before calling this function. If the device is active, the temperature returned will be the last temperature returned from this function.
[in] | device | Device handle. |
[out] | temp | Pointer to a 32-bit floating point value. If the function returns successfully, the value temp points to will contain the current device temperature. |
SA_API saStatus saQueryDiagnostics | ( | int | device, |
float * | voltage | ||
) |
A USB voltage below 4.55V may cause readings to be out of spec. Check your cable for damage and USB connectors for damage or oxidation.
[in] | device | Device handle. |
[out] | voltage | Pointer to a 32-bit floating point value. If the function returns successfully the variable voltage points to will contain the current voltage of the system. |
SA_API saStatus saAttachTg | ( | int | device | ) |
This function attempts to pair an unclaimed Signal Hound tracking generator with an open Signal Hound spectrum analyzer.
[in] | device | Device handle. |
SA_API saStatus saIsTgAttached | ( | int | device, |
bool * | attached | ||
) |
This function is a helper function to determine if a tracking generator has been previously paired with the specified device.
[in] | device | Device handle. |
[out] | attached | Pointer to a boolean variable. If this function returns successfully, the variable attached points to will contain a true/false value as to whether a tracking generator is paired with the spectrum analyzer. |
SA_API saStatus saConfigTgSweep | ( | int | device, |
int | sweepSize, | ||
bool | highDynamicRange, | ||
bool | passiveDevice | ||
) |
This function configures the tracking generator sweeps. Through this function you can request a sweep size. The sweep size is the number of discrete points returned in the sweep over the configured span. The final value chosen by the API can be different than the requested size by a factor of 2 at most. The dynamic range of the sweep is determined by the choice of highDynamicRange and passiveDevice. A value of true for both provides the highest dynamic range sweeps. Choosing false for passiveDevice suggests to the API that the device under test is an active device (amplification).
[in] | device | Device handle. |
[in] | sweepSize | Suggested sweep size. |
[in] | highDynamicRange | Request the ability to perform two store thrus for an increased dynamic range sweep. |
[in] | passiveDevice | Specify whether the device under test is a passive device (no gain). |
SA_API saStatus saStoreTgThru | ( | int | device, |
int | flag | ||
) |
This function, with flag set to TG_THRU_0DB, notifies the API to use the last trace as a thru (your 0 dB reference). Connect your tracking generator RF output to your spectrum analyzer RF input. This can be accomplished using the included SMA to SMA adapter, or anything else you want the software to establish as the 0 dB reference (e.g. the 0 dB setting on a step attenuator, or a 20 dB attenuator you will be including in your amplifier test setup).
After you have established your 0 dB reference, a second step may be performed to improve the accuracy below -40 dB. With approximately 20-30 dB of insertion loss between the spectrum analyzer and tracking generator, call saStoreTgThru with flag set to TG_THRU_20DB. This corrects for slight variations between the high gain and low gain sweeps.
[in] | device | Device handle. |
[in] | flag | Specify the type of store thru. Possible values are TG_THRU_0DB and TG_THRU_20DB. |
SA_API saStatus saSetTg | ( | int | device, |
double | frequency, | ||
double | amplitude | ||
) |
This function sets the output frequency and amplitude of the tracking generator. This can only be performed if a tracking generator is paired with a spectrum analyzer and is currently not configured and initiated for TG sweeps.
[in] | device | Device handle. |
[in] | frequency | Set the frequency, in Hz, of the TG output. |
[in] | amplitude | Set the amplitude, in dBm, of the TG output. |
SA_API saStatus saSetTgReference | ( | int | device, |
int | reference | ||
) |
Configure the time base for the tracking generator attached to the device specified. When SA_REF_UNUSED is specified additional frequency corrections are applied. If using an external reference or you are using the TG time base frequency as the frequency standard in your system, you will want to specify SA_REF_INTERNAL_OUT or SA_REF_EXTERNAL_IN so the additional corrections are not applied.
[in] | device | Device handle. |
[in] | reference | A valid time base setting value. Possible values are SA_REF_UNUSED, SA_REF_INTERNAL_OUT, and SA_REF_EXTERNAL_IN. |
SA_API saStatus saGetTgFreqAmpl | ( | int | device, |
double * | frequency, | ||
double * | amplitude | ||
) |
Retrieve the last set TG output parameters the user set through the saSetTg function. The saSetTg function must have been called for this function to return valid values. If the TG was used to perform scalar network analysis at any point, this function will not return valid values until the saSetTg function is called again.
If a previously set parameter was clamped in the saSetTg function, this function will return the final clamped value.
If any pointer parameter is null, that value is ignored and not returned.
[in] | device | Device handle. |
[out] | frequency | The double variable that frequency points to will contain the last set frequency of the TG output in Hz. |
[out] | amplitude | The double variable that amplitude points to will contain the last set amplitude of the TG output in dBm. |
SA_API saStatus saConfigIFOutput | ( | int | device, |
double | inputFreq, | ||
double | outputFreq, | ||
int | inputAtten, | ||
int | outputGain | ||
) |
The SA124A/B allows a user to configure the device to route the 6 MHz bandwidth intermediate frequency directly to the IF output BNC port. While the IF is routed to the BNC port, the device is incapable of performing sweeps or I/Q streaming. There is no image rejection in this mode.
Calling this function while the device is currently active in a different mode will cause the API to abort the current mode of operation and enable the IF output BNC port. To disable the IF output, simply call saInitiate with the new desired configuration.
The local oscillator mixed with the RF must be 138 MHz or higher, so only high side injection is available below 201 MHz.
[in] | device | Device handle. |
[in] | inputFreq | The input center frequency on the SMA connector specified in Hz. Must be between 125MHz and 13GHz. |
[in] | outputFreq | The desired output frequency on the BNC port specified in Hz. Positive for low-side LO injection, negative for high-side. Must be between 34 and 38MHz for the SA124A and between 61 and 65MHz for the SA124B. |
[in] | inputAtten | Attenuation of the input signal specified in dB. Must be between 0 and 30 dB. |
[in] | outputGain | Amplification of the output signal specified in dB. Must be between 0 and 60 dB. |
SA_API saStatus saSelfTest | ( | int | device, |
saSelfTestResults * | results | ||
) |
Performs a self-test and returns the results in an saSelfTestResults struct.
[in] | device | Device handle. |
[out] | results | A pointer to an saSelfTestResults struct. |
SA_API const char * saGetAPIVersion | ( | ) |
Get the current API version.
The returned string is of the form major.minor.revision
.
Ascii periods (“.”) separate positive integers. Major/Minor/Revision are not gauranteed to be a single decimal digit. The string is null terminated. An example string is below..
[ ‘1’ | ‘.’ | ‘2’ | ‘.’ | ‘1’ | ‘1’ | ‘\0’ ] = “1.2.11”
SA_API const char * saGetProductID | ( | ) |
The product ID is 4302-1103.