This macro can be used after each API call and can contain any error handling and reporting logic
necessary. A macro such as this can clean up code, and keep logic in one location making error handling
and reporting changes fast and easy.
Sweep Mode
Below is a simple example for configuring a BB60 to perform a single sweep. The example shows all the
necessary functions needed to open, configure, initialize, get data from, and close the device.
int handle;
// Attempt to open a connected device
if(bbOpenDevice(&handle) != bbNoError) {
myErrorRoutine("Device didn't open");
}
// Configure a sweep from 850MHz to 950MHz with an
// RBW and VBW of 10kHz and an expected input of -20dBm or less
bbConfigureAcquisition(handle, BB_MIN_AND_MAX, BB_LOG_SCALE);
bbConfigureCenterSpan(handle, 900.0e6, 100.0e6);
bbConfigureLevel(handle, -20.0, BB_AUTO_ATTEN);
bbConfigureGain(handle, BB_AUTO_GAIN);
bbConfigureSweepCoupling(handle, 10.0e3, 10.0e3, 0.001, BB_NON_NATIVE_RBW,
BB_NO_SPUR_REJECT);
bbConfigureProcUnits(handle, BB_LOG);
// Configuration complete, initialize the device
if(bbInitiate(handle, BB_SWEEPING, 0)) {
myErrorRoutine("Device couldn't initialize");
}
// Get sweep characteristics and allocate memory for sweep
unsigned int sweepSize;
double binSize, startFreq;
bbQueryTraceInfo(handle, &sweepSize, &binSize, &startFreq);
float *min = new float[sweepSize];
float *max = new float[sweepSize];
// Get one sweep
bbFetchTrace_32f(handle, sweepSize, min, max);
// Finished/close device
bbCloseDevice(handle);
Real-Time Mode
Below is an example of configuring and initializing the device for real-time mode. The example outlines
the steps required to fully configure a BB60 device and retrieve the sweep size and frame size of a real-
time session. One full sweep/frame is retrieved before closing the device.
int handle;
// Attempt to open a connected device
if(bbOpenDevice(&handle) != bbNoError) {
myErrorRoutine("Device didn't open");
}