WaveForms SDK Reference Manual
WaveForms SDK Reference Manual
Pullman, WA 99163
509.334.6306
www.digilentinc.com
Table of Contents
Table of Contents....................................................................................................1
Overview.................................................................................................................3
2 System.............................................................................................................9
4 Device Control................................................................................................ 14
5 Analog In (Oscilloscope)................................................................................. 20
Overview
WaveFormsTM provides an interface that allows users to interact with Digilent Analog Design hardware, such as the
Analog DiscoveryTM, Analog Discovery 2TM, Analog Discovery ProTM, Digital DiscoveryTM, Discovery Power SupplyTM
and Electronics ExplorerTM. While the WaveForms application offers a refined graphical interface, the WaveForms
SDK provides access to a public application programming interface (API) that gives users the ability to create
custom PC applications.
This WaveForms SDK manual describes the main components and architecture of the WaveForms system and
details each function contained in the WaveForms API. The SDK package also offers examples demonstrating how
to identify, connect to, and control analog hardware devices.
WaveForms System
USB Ethernet
1 The System
The WaveForms System is comprised of multiple components. The most visible component is the WaveForms
Application; a suite of graphical instrument panels that give full access to the analog and digital instruments in the
connected hardware. The WaveForms application uses WaveForms Runtime to communicate with the device. For
a custom application it is sufficient to access only the WaveForms Runtime, but both of these Runtimes are
required on the target machine in order to run the application. The WaveForms Runtime is comprised of the DWF
Dynamic Library and several configuration files. This library is located in:
• Windows in System Directory: C: \Windows\System32\dwf.dll
• Linux: /usr/lib/libdwf.so.x.x.x
The static library is located in Windows through the install path:
• Windows 32-bit: C:\Program Files (x86)\Digilent\WaveFormsSDK\lib\x86
• Windows 64-bit: C:\Program Files (x86)\Digilent\WaveFormsSDK\lib\x64
• Windows ARM64: C:\Program Files (x86)\Digilent\WaveFormsSDK\lib\arm64
• Windows ARM64EC: C:\Program Files (x86)\Digilent\WaveFormsSDK\lib\arm64ec
The C header file is located in:
• Windows 32-bit: C:\Program Files\Digilent\WaveFormsSDK\inc
• Windows 64-bit: C:\Program Files (x86)\Digilent\WaveFormsSDK\inc
• Linux: /usr/include/digilent/waveforms
Working code examples are provided with the SDK to demonstrate basic use of each API function set. You can find
samples in the installation directory, which are located here:
• Windows 32-bit: C:\Program Files\Digilent\WaveFormsSDK\samples
• Windows 64-bit: C:\Program Files (x86)\Digilent\WaveFormsSDK\samples
• Linux: /usr/share/digilent/waveforms/samples
• OS X: /Applications/WaveForms.app/Contents/Resources/SDK/
The DWF Library uses Digilent Adept Runtime, which provides basic communication with the targeted hardware
instruments (i.e., Analog Discovery and Electronics Explorer). Although the Adept Runtime is an integral part of the
WaveForms System, knowledge of its structure is not required to write custom applications.
Everything needed to write custom applications is included in the WaveForms SDK, which provides the
header/library files and documentation to access the API for the DWF Library. A custom application must properly
link to these files to make the appropriate API function calls. Every function in the WaveForms public API is
declared in the dwf.h header file.
Basic usage of the WaveForms API can be broken down into the following steps:
1. Call enumeration functions to discover connected hardware devices.
2. Call FDwfDeviceOpen function to establish a connection to specific hardware device.
3. Call function to enable instrument within hardware device.
4. Call functions to configure instrument and acquire/generate signals.
5. Call function to disable instrument.
6. Call FDwfDeviceClose function to disconnect from device.
There are nine main groups of API functions, each named with different prefixes:
Each instrument is directly controlled using three types of functions in the API:
Reset function This function resets all of the instrument parameters to FDwfAnalogInReset
default values.
FDwfAnalogOutReset
FDwfDigitalIOReset
Configure This function configures and/or starts the instrument. FDwfAnalogInConfigure
function
FDwfAnalogOutConfigure
FDwfDigitalIOConfigure
Status function This function polls and reads all information from the FDwfAnalogInStatus
instrument.
FDwfAnalogOutStatus
FDwfDigitalIOStatus
Note: Although there are multiple “Status” functions for each instrument, these functions are the only ones that actually read
data from the device.
There are several type definitions and corresponding constants in the dwf.h include file. The majority of them are
used as parameters. When a hardware device is opened, a handle is returned (HDWF), which is used to access and
finally close in all instrument API functions.
File Description
Device_Enumeration List the supported and connected devices.
AnalogIO_AnalogDiscovery_SystemMonitor Reading the system monitor information
AnalogIO_AnalogDiscovery_Power Enable power supplies.
AnalogOut_Sine Generate sine waveform on analog out channel.
AnalogOut_Sweep Generate frequency sweep.
AnalogOut_Custom Arbitrary waveform generation.
AnalogOut_Sync How to synchronize the analog output channels
AnalogOutIn Generate analog output signal and perform analog in
acquisition.
AnalogIn_Sample Open the first device, configure analog in and read single
sample.
AnalogIn_Acquisition Perform acquisition and plot data for first channel.
AnalogIn_Trigger Perform triggered acquisition.
AnalogIn_Record Performs recording of large number of samples.
DigitalIO Drive and read digital IO pins
DigitalOut_Pins Generate pulse, random and custom signal on digital out pins.
DigitalOut_BinaryCounter Generate binary counter
DigitalIn_Acquisition Generate signals on digital out and perform acquisition on
digital in.
DigitalIn_Record Perform recording of large number of digital in samples.
To compile and link the c/cpp applications with the dwf library use:
Window: gcc device_enumeration.cpp -L../../lib/x86 -ldwf
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners. Page 6 of 159
WaveForms™ SDK Reference Manual
The API functions are C style and return a integer value: 1 if the call is successful, 0 if unsuccessful. Further
information about the failure can be obtained using the FDwfGetLastError and FDwfGetLastErrorMsg functions.
In general, the API functions contain variations of the following parameters:
*Info Returns detailed information about the parameter support for the instrument (i.e.,
minimum/maximum values, supported modes, etc.)
*Set Sets an instrument parameter. When the AutoConfigure is enabled (by default), the instrument
is reconfigured and stopped.
*Get Gets the actual instrument parameter. Use this function to get the actual set value. For
instance, an arbitrary voltage offset is set and Get returns the real DAC output value.
*Status Returns the parameter value from the device.
The API functions won’t fail when a parameter pointer is NULL or when a setting (*Set) parameter value is out of
limits. To verify the actual setting value, use *Get API to return the actual value.
The indices used in function parameters are zero based.
The supported discrete parameters are retrieved in bit field value. To decode the capabilities of the device, use the
IsBitSet macro.
int fsfilter;
FDwfAnalogInChannelFilterInfo(h, &fsfilter)
if(IsBitSet(fsfilter, filterAverage)){
FDwfAnalogInChannelFilterSet(hdwf, 0, filterAverage)
}
For better performance it is recommended to disable AutoConfigure after opening a device. This will prevent each
FDwf*Set call to communicate with the device which can take considerable time.
FDwfDeviceAutoConfigureSet(hdwf, 0)
bool myFunction(){
if(!FDwf…(…)) return false
if(!FDwf…(…)) return false
…
return true
}
if(!myFunction()){
char szError[512]
FDwfGetLastErrorMsg(szError)
print(szError)
}
2 System
FDwfGetLastError(DWFERC *pdwferc)
Description: Retrieves the last error code in the calling process. The error code is cleared when other API functions
are called and is only set when an API function fails during execution. Error codes are declared in dwf.h:
DWFERC int Error Code Definition
Parameters:
- pdwferc – Variable to receive error code.
FDwfGetLastErrorMsg(char szError[512])
Description: Retrieves the last error message. This may consist of a chain of messages, separated by a new line
character, that describe the events leading to the failure.
Parameters:
- szError – Pointer to buffer to receive error string.
FDwfGetVersion(char szVersion[32])
Description: Retrieves the version string. The version string is composed of major, minor, and build numbers (i.e.,
“2.0.19”).
Parameters:
- szVersion – Pointer to buffer to receive version string.
Description: Configures various global parameters that will be applied on newly opened devices.
DwfParam int
DwfParamLedBrightness 3 0..100 % LED brightness
Supported by Digital Discovery
DwfParamOnClose 4 Device close behavior.
0 = Continue, keep running
1 = Stop the device outputs but keep the device operational to prevent
temperature drifts
2 = Shutdown device to minimize power consumption
DwfParamAudioOut 5 1 = Enable audio output (default)
0 = Disable audio output
Supported by Analog Discovery 1 and 2
DwfParamUsbLimit 6 USB current limitation in mA, recommended value 600-1000.
Supported by Analog Discovery 1 and 2
DwfParamAnalogOut 7 1 = Enable Wavegen outputs (default)
0 = Disable
Supported by ADP3X50
DwfParamFrequency 8 Adjust system frequency in Hz (default 100MHz)
Supported by Digital Discovery, ADP3X50, Analog Discovery 3
DwfParamExtFreq 9 Specify for input or set reference output frequency in Hz (default 10MHz)
Supported by ADP3X50, Analog Discovery 3
DwfParamClockMode 10 0 = use internal oscillator (default)
1 = enable reference output on Trigger IO 1
2 = use reference input from Trigger IO 1
3 = use Trigger IO 1 as reference input-output (only ADP3X50)
Supported by ADP3X50, Analog Discovery 3
DwfParamTempLimit 11 Specifies the over temperature threshold in degree Celsius on devices
which support such option.
DwfParamFreqPhase 12 Specifies the system clock phase which is useful for device
synchronization when reference input clock is used.
DwfParamDigitalVoltage 13 Adjusts the digital IO voltage in mV.
Supported by Digital Discovery, ADP3X50
Parameters:
- param – Pointer to buffer to receive version string.
- value – Value to set.
3 Device Enumeration
The FDwfEnum functions are used to discover all connected, compatible devices.
See examples: Device_Enumeration.py, Device_Info.py, Device_InfoEx.py.
Description: Builds an internal list of detected devices filtered by the enumfilter parameter. It must be called
before using other FDwfEnum functions because they obtain information about enumerated devices
from this list identified by the device index.
ENUMFILTER int
enumfilterAll 0 Enumerate all supported devices
DEVID devid Use devid to filter specific devices
enumfilterType 0x8000000 Use in conjunction with the following filters:
enumfilterUSB 0x0000001 USB devices
enumfilterNetwork 0x0000002 Network devices
enumfilterAXI 0x0000004 Embedded devices
enumfilterRemote 0x1000000 Remote table devices
enumfilterAudio 0x2000000 Sound card device
enumfilterDemo 0x4000000 Demo devices
Parameters:
- enumfilter – Filter value to be used for device enumeration. Use the enumfilterAll constant to discover all
compatible devices or “enumfilterType| enumfilterUSB”
- pnDevice – Integer pointer to return count of found devices by reference.
Example:
FDwfEnum(enumfilterAll, &nDev) # list all devices
FDwfEnum(devidDiscovery3, &nDev) # list Analog Discovery 3 devices
FDwfEnum(enumfilterType|enumfilterUSB|enumfilterAXI, &nDev) # list USB and AXI devices
FDwfEnumStart(ENUMFILTER enumfilter)
FDwfEnumStop(int *pnDevice)
Description: Stops enumeration andeturns the number of detected devices. Call this function after
FDwfEnumStart.
Parameters:
- pnDevice – Integer pointer to return count of found devices by reference.
Parameters:
- idxDevice – Zero based index of the enumerated device for which to return the type and revision.
- pDeviceId – Variable to return the device id.
- pDeviceRevision – Pointer to DEVVER instance to return the device revision by reference.
Description: Retrieves a Boolean specifying if a device is already opened by this, or any other process.
Parameters:
- idxDevice – Index of the enumerated device.
- pfIsUsed – Pointer to variable to receive Boolean indicating if the device is in use.
Description: Retrieves the 12-digit, unique serial number of the enumerated device.
Parameters:
- idxDevice – Index of the enumerated device.
- szSN – Pointer to character array to return the serial number by reference.
Description: Builds an internal list of detected configurations for the selected device. The function above must be
called before using other FDwfEnumConfigInfo function because this obtains information about
configurations from this list identified by the configuration index.
Parameters:
- idxDevice – Index of the enumerated device.
- pcConfig – Integer pointer to return count of found configurations by reference.
Description: Returns information about the configuration. These are intended for preliminary information before
opening a device. Further information are available with various the FDwf#Info functions.
DwfEnumConfigInfo int
DECIAnalogInChannelCount 1
DECIAnalogOutChannelCount 2
DECIAnalogIOChannelCount 3
DECIDigitalInChannelCount 4
DECIDigitalOutChannelCount 5
DECIDigitalIOChannelCount 6
DECIAnalogInBufferSize 7
DECIAnalogOutBufferSize 8
DECIDigitalInBufferSize 9
DECIDigitalOutBufferSize 10
Parameters:
- idxConfig – Index of the configuration for which to return the information.
- info – Information type.
- pValue – Integer pointer to return selected information type by reference.
4 Device Control
Description: Opens a device identified by the enumeration index and retrieves a handle. To automatically
enumerate all connected devices and open the first discovered device, use index -1.
Parameters:
- idxDevice – Zero based index of the enumerated device.
- phdwf – Pointer to HDWF variable to receive opened interface handle by reference.
Description: Opens a device identified by the enumeration index with the selected configuration and retrieves a
handle.
Parameters:
- idxDevice – Index of the enumerated device.
- idxCfg – Index of the device configuration.
- phdwf – Pointer to HDWF variable to receive opened interface handle by reference.
FDwfDeviceClose(HDWF hdwf)
Description: Closes an interface handle when access to the device is no longer needed. Once the function above
has returned, the specified interface handle can no longer be used to access the device.
Parameters:
- hdwf – Interface handle to be closed.
FDwfDeviceCloseAll()
Description: Closes all opened devices by the calling process. It does not close all devices across all processes.
Parameters: None.
Description: Enables or disables the AutoConfig setting for a specific device. When this setting is enabled, the
device is automatically configured every time an instrument parameter is set. For example, when
AutoConfigure is enabled, FDwfAnalogOutConfigure does not need to be called after
FDwfAnalogOutRunSet. This adds latency to every Set function; just as much latency as calling the
corresponding Configure function directly afterward. With value 3 the analog-out configuration will
be applied dynamically, without stopping the instrument.
Parameters:
- hdwf – Interface handle.
- fAutoConfigure– Value for this option: 0 disable, 1 enable, 3 dynamic
Description: Returns the AutoConfig setting in the device. See the function description for
FDwfDeviceAutoConfigureSet for details on this setting.
Parameters:
- hdwf – Interface handle.
- pfAutoConfigure – Pointer to variable to receive the current value of this option.
FDwfDeviceReset(HDWF hdwf)
Description: Resets and configures (by default, having auto configure enabled) all device and instrument
parameters to default values.
Parameters:
- hdwf – Interface handle.
The global trigger bus allows multiple instruments to trigger each other. These trigger source options are:
Manual / PC
Ext/Trig
AnalogIn DigitalIn
Control Control
ADC DI/O
AnalogOut DigitalOut
Control Control
Description: Returns the supported trigger source options for the global trigger bus. They are returned (by
reference) as a bit field. This bit field can be parsed using the IsBitSet Macro. Individual bits are
defined using the TRIGSRC constants in dwf.h.
Parameters:
- hdwf – Interface handle.
- pfstrigsrc – Variable to receive the supported trigger sources.
Description: Configures the trigger I/O pin with a specific TRIGSRC option.
Parameters:
- hdwf – Interface handle.
- idxPin – External trigger, I/O pin index.
- trigsrc – Trigger source to set.
Description: Returns the configured trigger setting for a trigger I/O pin. The trigger source can be “none”, an
internal instrument, or an external trigger.
Parameters:
- hdwf – Interface handle.
- idxPin – External trigger, I/O pin index.
- ptrigsrc – Variable to receive the current trigger source.
FDwfDeviceTriggerPC(HDWF hdwf)
Description: Returns the supported trigger slopes: rising, falling and either edge.
Parameters:
- hdwf – Interface handle.
- pfsslope – Variable to receive the supported trigger slopes.
5 Analog In (Oscilloscope)
Reconfigure?
Ready Configure Armed
Start? Start?
Trigger?
Prefill
Done Running
- Ready: Initial state. After FDwfAnalogInConfigure or any FDwfAnalogIn*Set function call goes to this state.
With FDwfAnalogInConfigure, reconfigure goes to Configure state.
- Configure: The needed configurations are performed, and auto trigger is reset.
- Prefill: Prefills the buffer with samples needed before trigger.
- Armed: Waits for the trigger.
- Running (Trig’d):
o Single acquisition mode: remains in this state to acquire samples after trigger according trigger
position parameter.
o Scan screen and shift modes: remains in this state until configure or any set function of this
instrument.
o Record mode: the time period according to the record length parameter.
- Done: Final state.
5.1 Control
5.1 Control
FDwfAnalogInReset(HDWF hdwf)
Description: Resets all AnalogIn instrument parameters to default values. If auto configure is enabled (through
FDwfDeviceAutoConfigureSet), the instrument is also configured.
Parameters:
- hdwf – Interface handle.
Description: Configures the instrument and start or stop the acquisition. To reset the Auto trigger timeout, set
fReconfigure to TRUE.
Parameters:
- hdwf – Interface handle.
- fReconfigure – Configure the device.
- fStart – Start the acquisition.
Description: Checks the state of the acquisition. To read the data from the device, set fReadData to TRUE. For
single acquisition mode, the data will be read only when the acquisition is finished.
Parameters:
- hdwf – Interface handle.
- fReadData – TRUE if data should be read.
- psts – Variable to receive the acquisition state.
Note: To ensure consistency between device status and measured data, the following AnalogInStatus*functions
do not communicate with the device. These functions only return information and data from the last
FDwfAnalogInStatus call.
Description: Retrieves the buffer write pointer which is needed in ScanScreen acquisition mode to display the scan
bar.
Parameters:
- hdwf – Interface handle.
- pidxWrite – Variable to receive the position of the acquisition.
FDwfAnalogInStatusData(
HDWF hdwf, int idxChannel, double *rgdVoltData, int cdData)
Description: Retrieves the acquired data samples from the specified idxChannel on the AnalogIn instrument. It
copies the data samples to the provided buffer.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgdVoltData – Pointer to allocated buffer to copy the acquisition data.
- cdData – Number of samples to copy.
FDwfAnalogInStatusData2(
HDWF hdwf, int idxChannel, double *rgdVoltData, int idxData, int cdData)
Description: Retrieves the acquired data samples from the specified idxChannel on the AnalogIn instrument. It
copies the data samples to the provided buffer.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgdVoltData – Pointer to allocated buffer to copy the acquisition data.
- idxData – First sample index to copy.
- cdData – Number of samples to copy.
FDwfAnalogInStatusData16(
HDWF hdwf, int idxChannel, short*rgs16Data, int idxData, int cdData)
Description: Retrieves the acquired raw data samples from the specified idxChannel on the AnalogIn instrument. It
copies the data samples to the provided buffer.
Example: To convert raw data voltage value:
rgs16Data[i] * FDwfAnalogInChannelRangeGet / 65536+FDwfAnalogInChannelOffsetGet
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgs16VoltData – Pointer to allocated buffer to copy the acquisition data.
- idxData – Source sample index to copy.
- cdData – Number of samples to copy.
FDwfAnalogInStatusNoise(
HDWF hdwf, int idxChannel, double *rgdMin, double *rgdMax, int cdData)
Description: Retrieves the acquired noise samples from the specified idxChannel on the AnalogIn instrument. It
copies the data samples to the provided buffer.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgdMin – Pointer to allocated buffer to copy the minimum noise data.
- rgdMax – Pointer to allocated buffer to copy the maximum noise data.
- cdData – Number of min/max samples to copy.
FDwfAnalogInStatusNoise2(
HDWF hdwf, int idxChannel, double *rgdMin, double *rgdMax,
int idxData, int cdData)
Description: Retrieves the acquired noise samples from the specified idxChannel on the AnalogIn instrument. It
copies the data samples to the provided buffer.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgdMin – Pointer to allocated buffer to copy the minimum noise data.
- rgdMax – Pointer to allocated buffer to copy the maximum noise data.
- idxData – First sample index to copy.
- cdData – Number of min/max samples to copy.
Description: Gets the last ADC conversion sample from the specified idxChannel on the AnalogIn instrument.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pdVoltSample – Variable to receive the sample value.
FDwfAnalogInStatusRecord(
HDWF hdwf, int *pcdDataAvailable, int *pcdDataLost, int *pcdDataCorrupt)
Description: Retrieves information about the recording process. The data loss occurs when the device acquisition
is faster than the read process to PC. In this case, the device recording buffer is filled and data
samples are overwritten. Corrupt samples indicate that the samples have been overwritten by the
acquisition process during the previous read. In this case, try optimizing the loop process for faster
execution or reduce the acquisition frequency or record length to be less than or equal to the device
buffer size (record length <= buffer size/frequency).
Parameters:
- hdwf – Interface handle.
- pcdDataAvailable – Pointer to variable to receive the available number of samples.
- pcdDataLost – Pointer to variable to receive the lost samples after the last check.
- pcdDataCorrupt – Pointer to variable to receive the number of samples that could be corrupt.
FDwfAnalogInStatusTime(HDWF hdwf,
unsigned int * psecUtc, unsigned int * ptick, unsigned int * pticksPerSecond)
Description: Sets the Record length in seconds. With length of zero, the record will run indefinitely.
Parameters:
- hdwf – Interface handle.
- sLegth – Record length to set expressed in seconds.
5.2 Configuration
Description: Retrieves the minimum and maximum (ADC frequency) settable sample frequency.
Parameters:
- hdwf – Interface handle.
- phzMin – Pointer to return the minimum allowed frequency.
- phzMax – Pointer to return the maximum allowed frequency.
Description: Reads the configured sample frequency. The AnalogIn ADC always runs at maximum frequency, but
the method in which the samples are stored in the buffer can be individually configured for each
channel with FDwfAnalogInChannelFilterSet function.
Parameters:
- hdwf – Interface handle.
- phzFrequency – Variable to receive the acquisition frequency.
Description: Returns the minimum and maximum allowable buffer sizes for the instrument.
Parameters:
- hdwf – Interface handle.
- pnMin – Pointer to return the minimum buffer size.
- pnMax – Pointer to return the maximum buffer size.
Description: Returns the used AnalogIn instrument noise buffer size. This is automatically adjusted according to
the sample buffer size. For instance, having maximum buffer size of 8192 and noise buffer size of
512, setting the sample buffer size to 4096 the noise buffer size will be 256.
Parameters:
- hdwf – Interface handle.
- pnSize – Variable to receive the current noise buffer size.
Description: Returns the supported AnalogIn acquisition modes. They are returned (by reference) as a bit field.
This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the ACQMODE
constants in dwf.h. The acquisition mode selects one of the following modes, ACQMODE:
ACQMODE int Constant Capabilities
acqmodeSingle 0 Perform a single buffer acquisition and rearm the instrument for next capture after
the data is fetched to host using FDwfAnalogInStatus or
FDwfDigitalInStatus function. This is the default setting.
acqmodeScanShift 1 Perform a continuous acquisition in FIFO style. The trigger setting is ignored. The
last sample is at the end of buffer. The
FDwfAnalog|DigitalInStatusSamplesValid function is used to show
the number of the acquired samples, which will grow until reaching the BufferSize.
Then the waveform “picture” is shifted for every new sample.
acqmodeScanScreen 2 Perform continuous acquisition circularly writing samples into the buffer. The
trigger setting is ignored. The IndexWrite shows the buffer write position. This is
similar to a heart monitor display.
acqmodeRecord 3 Perform record acquisition by streaming data to host.
acqmodeOvers 4 With ADP3000 device series the consecutive captures are shifted by in four phases
relative to the other instruments (AnalogOut, DigitalIn/Out)
Othewise it is identical to acqmoeSingle.
acqmodeSingle1 5 Perform a single buffer acquisition without rearming the instrument.
Parameters:
- hdwf – Interface handle.
- pfsacqmode – Pointer to return the supported acquisition modes.
Description: Returns the maximum supported device buffers (memory segmentation) for acqmodeSingle,
Oversample for low latency sequential captures.
Parameters:
- hdwf – Interface handle.
- pnMax – Pointer to return the maximum buffers.
5.3 Channels
Description: Gets the current enable/disable status of the specified AnalogIn channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Index of channel.
- pfEnable – Variable to return enable/disable status of channel.
Description: Returns the supported sampling modes. They are returned (by reference) as a bit field. This bit field
can be parsed using the IsBitSet Macro. Individual bits are defined using the FILTER constants in
dwf.h. When the acquisition frequency (FDwfAnalogInFrequencySet) is less than the ADC frequency
(maximum acquisition frequency).
Parameters:
- hdwf – Interface handle.
- pfsfilter – Pointer to return the supported acquisition modes.
Description: Sets the acquisition filter for each AnalogIn channel. With channel index -1, each enabled AnalogIn
channel filter will be configured to use the same, new option.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- filter – Acquisition sample filter to set, default is filterDecimate
FDwfAnalogInChannelRangeInfo(
HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps)
Description: Returns the minimum and maximum range, peak to peak values, and the number of adjustable steps.
Parameters:
- hdwf – Interface handle.
- pvoltsMin – Variable to receive the minimum voltage range.
- pvoltsMax – Variable to receive the maximum voltage range.
- pnSteps – Variable to receive number of steps.
FDwfAnalogInChannelRangeSteps(
HDWF hdwf, double rgVoltsStep[32], int *pnSteps)
Description: Reads the range of steps supported by the device. For instance: 1, 2, 5, 10, etc.
Parameters:
- hdwf – Interface handle.
- rgVoltsStep – Pointer to buffer to receive the range steps.
- pnSteps – Variable to receive number range steps.
Description: Configures the range for each channel. With channel index -1, each enabled Analog In channel range
will be configured to the same, new value.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- voltsRange – Voltage range to set.
The actual range of the device may be different depending on the hardware design and calibration (tolerance of
the components). For example, when setting 5V range the actual input range may be 5.456789V, which is returned
by the FDwfAnalogInChannelRangeGet function.
With the filterAverageFit option the range is respected down to 1/100 of the hardware range, like a device with
approximately 5V input range can be as low as 50mV.
Description: Returns the real range value for the given channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pvoltsRange – Variable to receive the current voltage range.
FDwfAnalogInChannelOffsetInfo(
HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps)
Description: Returns the minimum and maximum offset levels supported, and the number of adjustable steps.
Parameters:
- hdwf – Interface handle.
- pvoltsMin – Variable to receive the minimum offset voltage.
- pvoltsMax – Variable to receive the maximum offset voltage.
- pnSteps – Variable to receive the number offset steps.
Description: Configures the offset for each channel. When channel index is specified as -1, each enabled AnalogIn
channel offset will be configured to the same level.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- voltsRange – Channel offset voltage to set.
Description: Returns for each AnalogIn channel the real offset level.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pvoltsRange – Variable to receive the offset voltage obtained.
FDwfAnalogInChannelAttenuationSet(
HDWF hdwf, int idxChannel, double xAttenuation)
Description: Configures the attenuation for each channel. When channel index is specified as -1, each enabled
AnalogIn channel attenuation will be configured to the same level. The attenuation does not change
the attenuation on the device, just informs the library about the externally applied attenuation.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- voltsRange – Channel attenuation to set.
FDwfAnalogInChannelAttenuationGet(
HDWF hdwf, int idxChannel, double *pxAttenuation)
FDwfAnalogInChannelBandwidthSet(
HDWF hdwf, int idxChannel, double hz)
FDwfAnalogInChannelBandwidthGet(
HDWF hdwf, int idxChannel, double *pHz)
FDwfAnalogInChannelImpedanceSet(
HDWF hdwf, int idxChannel, double ohms)
FDwfAnalogInChannelImpedanceGet(
HDWF hdwf, int idxChannel, double *pOhms)
FDwfAnalogInChannelCouplingInfo(
HDWF hdwf, int *pfscoupling)
FDwfAnalogInChannelCouplingSet(
HDWF hdwf, int idxChannel, DwfAnalogCoupling coupling)
Description: Configures the coupling for each channel. When channel index is specified as -1, each enabled
AnalogIn channel coupling will be configured to the same level.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- coupling – Channel coupling to set, DwfAnalogCoupling:
- 0 DwfAnalogCouplingDC
- 1 DwfAnalogCouplingAC
FDwfAnalogInChannelCouplingGet(
HDWF hdwf, int idxChannel, DwfAnalogCoupling *pcoupling)
Description: Returns for each AnalogIn channel the real offset level.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pcoupling – Variable to receive the coupling.
DwfFiirInput int
DwfFiirRaw 0 Filter is performed on raw ADC conversions at system frequency.
DwfFiirDecimate 1 Filter is performed on every Nth conversion set by the
FDwfAnalogInFrequencySet function.
DwfFiirAverage 2 Filter is perform on every Nth average sample.
DwfFiirMode int
DwfFiirType int
DwfFiirLowPass 0
DwfFiirHighPass 1
DwfFiirBandPass 2
DwfFiirBandStop 3
FDwfAnalogInChannelWindowSet(
HDWF hdwf, int idxChannel, DwfWindow win, int size, int beta)
FDwfAnalogInChannelCustomWindowSet(
HDWF hdwf, int idxChannel, const double *rg, int size, int normalize)
5.4 Trigger
The trigger is used for Single and Record acquisitions. For ScanScreen and ScanShift, the trigger is ignored.
To achieve the classical trigger types:
- None: Set FDwfAnalogInTriggerSourceSet to trigsrcNone.
- Auto: Set FDwfAnalogInTriggerSourceSet to something other than trigsrcNone, such as
trigsrcDetectorAnalogIn and FDwfAnalogInTriggerAutoTimeoutSet to other than zero.
- Normal: Set FDwfAnalogInTriggerSourceSet to something other than trigsrcNone, such as
trigsrcDetectorAnalogIn or FDwfAnalogInTriggerAutoTimeoutSet to zero.
See the description of FDwfDeviceTriggerInfo.
Description: Returns the configured trigger source. The trigger source can be “none” or an internal instrument or
external trigger. To use the trigger on AnalogIn channels (edge, pulse, etc.), use
trigsrcDetectorAnalogIn.
Parameters:
- hdwf – Interface handle.
- ptrigsrc – Variable to receive the current trigger source.
FDwfAnalogInTriggerForce(HDWF hdwf)
FDwfAnalogInTriggerPositionInfo(
HDWF hdwf, double *psecMin, double *psecMax, double *pnSteps)
Description: Returns the minimum and maximum values of the trigger position in seconds.
For Single/Repeated acquisition mode the horizontal trigger position is used is relative to the buffer
middle point.
For Record mode the position is relative to the start of the capture.
Parameters:
- hdwf – Interface handle.
- psecMin – Variable to receive the minimum trigger position.
- psecMax – Variable to receive the maximum trigger position.
- pnSteps – Variable to return the number of steps.
FDwfAnalogInTriggerAutoTimeoutInfo(
HDWF hdwf, double *psecMin, double *psecMax, double *pnSteps)
Description: Returns the minimum and maximum auto trigger timeout values, and the number of adjustable steps.
The acquisition is auto triggered when the specified time elapses. With zero value the timeout is
disabled, performing “Normal” acquisitions.
Parameters:
- hdwf – Interface handle.
- psecMin – Variable to receive the minimum timeout.
- psecMax – Variable to receive the maximum timeout.
- pnSteps – Variable to return the number of steps.
FDwfAnalogInTriggerHoldOffInfo(
HDWF hdwf, double *psecMin, double *psecMax, double *pnStep)
Description: Returns the supported range of the trigger Hold-Off time in Seconds. The trigger hold-off is an
adjustable period of time during which the acquisition will not trigger. This feature is used when you
are triggering on burst waveform shapes, so the oscilloscope triggers only on the first eligible trigger
point.
Parameters:
- hdwf – Interface handle.
- psecMin – Variable to receive the minimum hold off value.
- psecMax – Variable to receive the maximum hold off value.
Description: Sets the trigger hold-off for the AnalongIn instrument in Seconds.
Parameters:
- hdwf – Interface handle.
- secHoldOff – Holdoff to set.
Description: Gets the current trigger hold-off for the AnalongIn instrument in Seconds.
Parameters:
- hdwf – Interface handle.
- psecHoldOff – Variable to receive the current holdoff value.
FDwfAnalogInCounterStatus(HDWF hdwf,
double *pcnt, double *pfreq, double *ptick)
The following functions configure the trigger detector on analog in channels. To use this, set trigger source with
FDwfAnalogInTriggerSourceSet to trigsrcDetectorAnalogIn.
See the AnalogIn_Trigger.py example.
Description: Returns the supported trigger type options for the instrument. They are returned (by reference) as a
bit field. This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the
TRIGTYPE constants in dwf.h. These trigger type options are:
• trigtypeEdge: trigger on rising or falling edge. This is the default setting.
• trigtypePulse: trigger on positive or negative; less, timeout, or more pulse lengths.
• trigtypeTransition: trigger on rising or falling; less, timeout, or more transition times.
• trigtypeWindow: trigger on exiting or entering level +/-hysteresis window.
Parameters:
- hdwf – Interface handle.
- pfstrigtype – Variable to receive the supported trigger types.
Description: Returns the supported trigger filters. They are returned (by reference) as a bit field which can be
parsed using the IsBitSet Macro. Individual bits are defined using the FILTER constants in DWF.h.
Select trigger detector sample source, FILTER:
• filterDecimate: Looks for trigger in each ADC conversion, can detect glitches.
• filterAverage: Looks for trigger only in average of N samples, given by
FDwfAnalogInFrequencySet.
Parameters:
- hdwf – Interface handle.
- pfsFilter – Variable to receive the supported trigger filters.
Description: Returns the supported trigger type options for the instrument. They are returned (by reference) as a
bit field. This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the
DwfTriggerSlope constants in dwf.h. These trigger condition options are:
• DwfTriggerSlopeRise (This is the default setting):
o For edge and transition trigger on rising edge.
o For pulse trigger on positive pulse; For window exiting.
• DwfTriggerSlopeFall:
o For edge and transition trigger on falling edge.
o For pulse trigger on negative pulse; For window entering.
• DwfTriggerSlopeEither:
o For edge and transition trigger on either edge.
o For pulse trigger on either positive or negative pulse.
Parameters:
- hdwf – Interface handle.
- pfstrigcond – Variable to receive the supported trigger conditions.
FDwfAnalogInTriggerLevelInfo(
HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps)
Description: Retrieves the range of valid trigger voltage levels for the AnalogIn instrument in Volts.
Parameters:
- hdwf – Interface handle.
- pvoltsMin – Variable to receive the minimum voltage level.
- pvoltsMax – Variable to receive the maximum voltage level.
- pnSteps – Variable to receive the number of voltage level steps.
FDwfAnalogInTriggerHysteresisInfo(
HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps)
Description: Retrieves the range of valid trigger hysteresis voltage levels for the AnalogIn instrument in Volts. The
trigger detector uses two levels: low level (TriggerLevel - Hysteresis) and high level (TriggerLevel +
Hysteresis). Trigger hysteresis can be used to filter noise for Edge or Pulse trigger. The low and high
levels are used in transition time triggering.
Parameters:
- hdwf – Interface handle.
- pvoltsMin – Variable to receive the minimum hysteresis level.
- pvoltsMax – Variable to receive the maximum hysteresis level.
- pnSteps – Variable to receive the number of hysteresis level steps.
Description: Returns the supported trigger length condition options for the AnalogIn instrument. They are
returned (by reference) as a bit field. This bit field can be parsed using the IsBitSet Macro. Individual
bits are defined using the TRIGLEN constants in DWF.h. These trigger length condition options are:
• triglenLess: Trigger immediately when a shorter pulse or transition time is detected.
• triglenTimeout: Trigger immediately as the pulse length or transition time is reached.
• triglenMore: Trigger when the length/time is reached, and pulse or transition has ended.
Parameters:
- hdwf – Interface handle.
- pfsstriglen – Variable to receive the supported trigger length conditions.
Description: Sets the trigger length condition for the AnalongIn instrument.
Parameters:
- hdwf – Interface handle.
- triglen – Trigger length condition to set.
Description: Gets the current trigger length condition for the AnalongIn instrument.
Parameters:
- hdwf – Interface handle.
- ptriglen – Variable to receive the current trigger length condition.
FDwfAnalogInTriggerLengthInfo(
HDWF hdwf, double *psecMin, double *psecMax, double *pnStep)
Description: Returns the supported range of trigger length for the instrument in Seconds. The trigger length
specifies the minimal or maximal pulse length or transition time.
Parameters:
- hdwf – Interface handle.
- psecMin – Variable to receive the minimum trigger length.
- psecMax – Variable to receive the maximum trigger length.
Start? Trigger?
Ready Armed Wait
The analog out channels can run independently or synchronized using the master parameter. The states are
defined by trigger, wait, run, and repeat options. It is enough to start with FDwfAnalogOutConfigure (the master
channel) the slave channels will also start.
Analog Out 1
States
Master
Generator
...
Analog Out 2
States
Master
Generator
...
...
Description: Resets and configures (by default, having auto configure enabled) all AnalogOut instrument
parameters to default values for the specified channel. To reset instrument parameters across all
channels, set idxChannel to -1.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
Description: Starts or stops the instrument. Value 3 will apply the configuration dynamically without changing the
state of the instrument. With channel index -1, each enabled Analog Out channel will be configured.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- fStart – Start the instrument: 0 stop, 1 start, 3 apply.
The device output signal is output from carrier buffer but can also be frequency and/or amplitude modulated.
The Carrier/FM/AM nodes can be configured by selecting with the AnalogOutNode constants.
AnalogOutNode int
AnalogOutNodeCarrier 0 Carrier signal
AnalogOutNodeFM 1 Frequency or Phase Modulation
AnalogOutNodeAM 2 Amplitude Modulation or Sum
Description: Retrieves information about the play buffer size. For devices with deep memory (ADP3X50, ADP2230)
up to this number of samples can be set at once. For devices without deep memory this will report
zero but play mode can be still used by sending data in chunks.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pnSamplesMin – Pointer to variable to return the minimum number of samples that be set.
- pnSamplesMax – Pointer to variable to return the maximum number of samples that be set.
Description: Retrieves information about the play process. The data lost occurs when the device generator is faster
than the sample send process from the PC. In this case, the device buffer gets emptied and
generated samples are repeated. Corrupt samples are a warning that the buffer might have been
emptied while samples were sent to the device. In this case, try optimizing the loop for faster
execution; or reduce the frequency or run time to be less or equal to the device buffer size (run time
<= buffer size/frequency).
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- cdDataFree – Pointer to variable to return the available free buffer space, the number of new samples that can
be sent.
- cdDataLost – Pointer to variable to return the number of lost samples.
- cdDataCorrupted – Pointer to variable to return the number of samples that could be corrupted.
FDwfAnalogOutNodePlayData(
HDWF hdwf, int idxChannel, AnalogOutNode node, double *rgdData, int cdData)
Description: Sends new data samples for play mode. Before starting the Analog Out instrument, prefill the device
buffer with the first set of samples using the AnalogOutNodeDataSet function. In the loop of sending
the following samples, first call AnalogOutStatus to read the information from the device, then
AnalogOutPlayStatus to find out how many new samples can be sent, then send the samples with
AnalogOutPlayData.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- rgdData – Pointer to samples array to be sent to the device.
- cdData – Number of samples to send.
6.2 Configuration
Description: Returns the number of Analog Out channels by the device specified by hdwf.
Parameters:
- hdwf – Open interface handle on a device.
- pcChannel – Pointer to variable to receive the number of channels in the instrument.
Description: Returns the supported AnalogOut nodes of the AnalogOut channel. They are returned (by reference)
as a bit field. This bit field can be parsed using the IsBitSet Macro.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pfsnode – Variable to receive the supported nodes.
FDwfAnalogOutNodeEnableSet(
HDWF hdwf, int idxChannel, AnalogOutNode node, int fMode)
Description: Enables or disables the channel node specified by idxChannel and node. The Carrier node enables or
disables the channel or selectects the modulation. With channel index -1, each Analog Out channel
enable will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- fEnable – Carrier: 0 disable, 1 enable; FM: 1 FM, 2 PM, 3 PMD; AM: 1 AM, 2 SUM, 3 SUMV
The PM, PMD, SUM and SUMV options are available with AD3, ADP2230, ADP3000 series and newer devices.
For PM (Phase Modulation) or PMD (expressed in degrees) the limits are ±100% or ±180°.
For SUM or SUMV (expressed in Volts) the limits are ±400% or in Volts the Offset ± Amplitude ca be up to four
times the Carrier Amplitude.
FDwfAnalogOutNodeEnableGet(
HDWF hdwf, int idxChannel, AnalogOutNode node, int *pfEnable)
FDwfAnalogOutNodeFunctionInfo(
HDWF hdwf, int idxChannel, AnalogOutNode node, int *pfsfunc)
Description: Returns the supported generator function options. They are returned (by reference) as a bit field. This
bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the FUNC constants
in dwf.h. These are:
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pfsfunc – Variable to receive the supported generator function options.
FDwfAnalogOutNodeFunctionSet(
HDWF hdwf, int idxChannel, AnalogOutNode node, FUNC func)
Description: Sets the generator output function for the specified instrument channel. With channel index -1, each
enabled Analog Out channel function will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- func – Generator function option to set.
FDwfAnalogOutNodeFunctionGet(
HDWF hdwf, int idxChannel, AnalogOutNode node, FUNC *pfunc)
Description: Retrieves the current generator function option for the specified instrument channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- ptrigsrc – Pointer to variable to receive the generator function option.
Description: Returns the supported frequency range for the instrument. The maximum value shows the DAC
frequency. The frequency of the generated waveform: repetition frequency for standard types and
custom data; DAC update for noise type; sample rate for play type.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Zero based channel index.
- node – Zero based node index.
- phzMin – Variable to receive the supported minimum frequency.
- phzMax – Variable to receive the supported maximum frequency.
FDwfAnalogOutNodeFrequencySet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double hzFrequency)
Description: Sets the frequency. With channel index -1, each enabled Analog Out channel frequency will be
configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- hzFrequency – Frequency value to set expressed in Hz.
FDwfAnalogOutNodeFrequencyGet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double *phzFrequency)
Description: Gets the currently set frequency for the specified channel-node on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- hzFrequency – Pointer to variable to receive frequency value in Hz.
FDwfAnalogOutNodeAmplitudeInfo(
HDWF hdwf, int idxChannel, AnalogOutNode node, double *pvMin, double *pvMax)
Description: Retrieves the amplitude range for the specified channel-node on the instrument. The amplitude is
expressed in Volt units for carrier and in percentage units (modulation index) for AM/FM.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pvMin – Minimum amplitude level or modulation index.
- pvMax – Maximal amplitude level or modulation index.
FDwfAnalogOutNodeAmplitudeSet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double vAmplitude)
Description: Sets the amplitude or modulation index for the specified channel-node on the instrument. With
channel index -1, each enabled Analog Out channel amplitude (or modulation index) will be
configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- vAmplitude – Amplitude of channel in Volts or modulation index in percentage.
FDwfAnalogOutNodeAmplitudeGet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double *pvAmplitude)
Description: Gets the currently set amplitude or modulation index for the specified channel-node on the
instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pvAmplitude – Pointer to variable to receive amplitude value in Volts or modulation index in percentage.
FDwfAnalogOutNodeOffsetInfo(
HDWF hdwf, int idxChannel, AnalogOutNode node, double *pvMin, double *pvMax)
Description: Retrieves available the offset range. For carrier node in units of volts, and in percentage units for
AM/FM nodes.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pvMin – Minimum offset voltage or modulation offset percentage.
- pvMax – Maximum offset voltage or modulation offset percentage.
FDwfAnalogOutNodeOffsetSet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double vOffset)
Description: Sets the offset value for the specified channel-node on the instrument. With channel index -1, each
enabled Analog Out channel offset will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- vOffset – Value to set voltage offset in Volts or modulation offset percentage.
Description: Gets the current offset value for the specified channel-node on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pvOffset – Pointer to variable to receive offset value in Volts or modulation offset percentage.
Description: Obtains the symmetry (or duty cycle) range (0 … 100). This symmetry is supported for standard signal
types. It the pulse duration divided by the pulse period.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- ppercentageMin – Minimum value of Symmetry percentage.
- ppercentageMax – Maximum value of Symmetry percentage.
Description: Sets the symmetry (or duty cycle) for the specified channel-node on the instrument. With channel
index -1, each enabled Analog Out channel symmetry will be configured to use the same, new
option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- percentageSymmetry –Value of percentage of Symmetry (duty cycle).
FDwfAnalogOutNodeSymmetryGet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double *ppercentageSymmetry)
Description: Gets the currently set symmetry (or duty cycle) for the specified channel-node of the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- ppercentageSymmetry – Pointer to variable to receive value of Symmetry (duty cycle).
Description: Retrieves the phase range (in degrees 0 ... 360) for the specified channel-node of the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pdegreeMin – Minimum value of Phase (in degrees).
- pdegreeMax – Maximum value of Phase (in degrees).
FDwfAnalogOutNodePhaseSet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double degreePhase)
Description: Sets the phase for the specified channel-node on the instrument. With channel index -1, each enabled
Analog Out channel phase will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- degreePhase – Value of Phase in degrees.
Description: Gets the current phase for the specified channel-node on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pdegreePhase – Pointer to variable to receive Phase value (in degrees).
Description: Retrieves the minimum and maximum number of samples allowed for custom data generation.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- pnSamplesMin – Minimum number of samples available for custom data.
- pnSamplesMax – Maximum number of samples available for custom data.
FDwfAnalogOutNodeDataSet(
HDWF hdwf, int idxChannel, AnalogOutNode node, double *rgdData, int cdData)
Description: Set the custom data or to prefill the buffer with play samples. The samples are double precision
floating point values (rgdData) normalized to ±1.
With the custom function option, the data samples (cdData) will be interpolated to the device buffer
size. The output value will be Offset + Sample*Amplitude, for instance:
• 0 value sample will output: Offset.
• +1 value sample will output: Offset + Amplitude.
• -1 value sample will output: Offset – Amplitude.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- node – Node index.
- rgbData – Buffer of samples to set.
- cData – Number of samples to set in rgbData.
-
FDwfAnalogOutLimitationInfo(
HDWF hdwf, int idxChannel, double *pvMin, double *pvMax)
Description: Retrieves the limitation range supported by the channel. This option is supported on Electronics
Explorer Analog Out Channel 3 and 4, Positive and Negative Power supplies, to set current or voltage
limitation.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pvMin – Minimum limitation value.
- pvMax – Maximum offset voltage or modulation offset percentage.
Description: Sets the limitation value for the specified channel on the instrument. With channel index -1, each
enabled Analog Out channel limitation will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- limit – Value to set voltage offset in Volts or modulation offset percentage.
Description: Gets the current limitation value for the specified channel on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- limit – Pointer to variable to receive offset value in Volts or modulation offset percentage.
Description: Set the generator output mode for the specified instrument channel. With channel index -1, each
enabled Analog Out channel mode will be configured to use the same, new option. This option is
supported on Electronics Explorer Analog Out Channel 3 and 4, Positive and Negative Power
supplies, to set current or voltage waveform generator mode.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- mode – Generator mode option to set.
Description: Retrieves the current generator mode option for the specified instrument channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- mode – Pointer to variable to receive the generator mode option.
Description: Returns the supported generator idle output options. They are returned (by reference) as a bit field.
This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the
DwfAnalogOutIdle constants in dwf.h.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pfsidlec – Variable to receive the supported generator idle options.
Description: Sets the generator idle output for the specified instrument channel. The idle output selects the output
while not running, Ready, Stopped, Done, or Wait states.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- idle – Generator function option to set.
Description: Retrieves the generator idle output option for the specified instrument channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pidle – Pointer to variable to receive the generator function option.
6.3 States
Description: Gets the current trigger source setting for the channel on instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- ptrigsrc – Pointer to variable to receive the trigger source.
FDwfAnalogOutTriggerSlopeSet(
HDWF hdwf, int idxChannel, DwfTriggerSlope slope)
FDwfAnalogOutTriggerSlopeGet(
HDWF hdwf, int idxChannel, DwfTriggerSlope *pslope)
Description: Gets the current trigger slope setting for the channel on instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pslope – Pointer to variable to receive the trigger slope.
FDwfAnalogOutRunInfo(
HDWF hdwf, int idxChannel, double *psecMin, double *psecMax)
Description: Returns the supported run length range for the instrument in Seconds. Zero values represent an
infinite (or continuous) run. Default value is zero.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- psecMin – Variable to receive the supported minimum run length.
- psecMax – Variable to receive the supported maximum run length.
Description: Reads the configured run length for the instrument in Seconds.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- psecRun – Pointer to variable to receive the run length.
Description: Reads the remaining run length. It returns data from the last FDwfAnalogOutStatus call.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- psecRun – Pointer to variable to receive the remaining run length.
FDwfAnalogOutWaitInfo(
HDWF hdwf, int idxChannel, double *psecMin, double *psecMax)
Description: Returns the supported wait length range in Seconds. The wait length is how long the instrument waits
after being triggered to generate the signal. Default value is zero.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- psecMin/Max – Variable to receive the supported minimum/maximum wait length.
Description: Gets the current wait length for the channel on instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- psecWait – Pointer to variable to receive the wait length.
Description: Returns the supported repeat count range. This is how many times the generated signal will be
repeated upon. Zero value represents infinite repeat. Default value is one.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pnMin – Variable to receive the supported minimum repeat count.
- pnMax – Variable to receive the supported maximum repeat count.
Description: Reads the remaining repeat counts. It only returns information from the last FDwfAnalogOutStatus
function call, it does not read from the device.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pcRepeat – Pointer to variable to receive the remaining repeat counts.
Description: Sets the repeat trigger option. To include the trigger in wait-run repeat cycles, set fRepeatTrigger to
TRUE. It is disabled by default.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- fRepeatTrigger – Boolean used to specify if the trigger should be included in a repeat cycle.
FDwfAnalogOutRepeatTriggerGet(
HDWF hdwf, int idxChannel, int *pfRepeatTrigger)
Description: Verifies if the trigger has been included in wait-run repeat cycles.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pfRepeatTrigger – Pointer to variable to receive the repeat trigger option.
Description: Sets the state machine master of the channel generator. With channel index -1, each enabled Analog
Out channel will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- idxMaster – Node index.
7 Analog I/O
The AnalogIO functions are used to control the power supplies, reference voltage supplies, voltmeters, ammeters,
thermometers, and any other sensors on the device. These are organized into channels which contain a number of
nodes. For instance, a power supply channel might have three nodes: an enable setting, a voltage level
setting/reading, and current limitation setting/reading.
FDwfAnalogIOReset(HDWF hdwf)
Description: Resets and configures (by default, having auto configure enabled) all AnalogIO instrument parameters
to default values.
Parameters:
- hdwf – Open interface handle on a device.
FDwfAnalogIOConfigure(HDWF hdwf)
FDwfAnalogIOStatus(HDWF hdwf)
Description: Reads the status of the device and stores it internally. The following status functions will return the
information that was read from the device when the function above was called.
Parameters:
- hdwf – Open interface handle on a device.
Description: Verifies if Master Enable Setting and/or Master Enable Status are supported for the AnalogIO
instrument. The Master Enable setting is essentially a software switch that “enables” or “turns on”
the AnalogIO channels. If supported, the status of this Master Enable switch (Enabled/Disabled) can
be queried by calling FDwfAnalogIOEnableStatus.
Parameters:
- hdwf – Open interface handle on a device.
- pfSet – Returns true when the master enable setting is supported.
- pfStatus – Return true when the status of the master enable can be read.
Description: Returns the current state of the master enable switch. This is not obtained from the device.
Parameters:
- hdwf – Open interface handle on a device.
- pfMasterEnable – Pointer to variable to return the enabled configuration.
Description: Returns the master enable status (if the device supports it). This can be a switch on the board or an
overcurrent protection circuit state.
Parameters:
- hdwf – Open interface handle on a device.
- pfMasterEnabled – Pointer to variable to return the active status.
FDwfAnalogIOChannelName(
HDWF hdwf, int idxChannel, char szName[32], char szLabel[16])
Description: Returns the name (long text) and label (short text, printed on the device) for a channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- szName – Pointer to character array to return the user name.
- szLabel – Pointer to character array to return the label.
Description: Returns the number of nodes associated with the specified channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pnNodes – Pointer to variable to return the number of node .
FDwfAnalogIOChannelNodeName(
HDWF hdwf, int idxChannel, int idxNode,
char szNodeName[32], char szUnits[16])
Description: Returns the node name (“Voltage”, “Current”…) and units (“V”, “A”) for an Analog I/O node.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- idxNode – Node index.
- szNodeName – Pointer to character array to return the node name.
- szUnits – Pointer to character array to return the value units.
FDwfAnalogIOChannelNodeInfo(
HDWF hdwf, int idxChannel, int idxNode, ANALOGIO *panalogio)
Description: Returns the supported channel nodes. They are returned (by reference) as a bit field. This bit field can
be parsed using the IsBitSet Macro. Individual bits are defined using the ANALOGIO constants in
dwf.h. The acquisition mode selects one of the following modes, ANALOGIO:
analogioEnable Enable I/O node; used to enable a power supply, reference voltage, etc.
analogioTemperature Temperature I/O node; used to retrieve read values from a temperature sensor.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- idxNode – Node index.
- panalogio – Pointer to variable to return the node type.
Description: Returns node value limits. Since a Node can represent many things (Power supply, Temperature
sensor, etc.), the Minimum, Maximum, and Steps parameters also represent different types of values.
In broad terms, the (Maximum – Minimum)/Steps = the number of specific input/output values.
FDwfAnalogIOChannelNodeInfo returns the type of values to expect and
FDwfAnalogIOChannelNodeName returns the units of these values.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Analog I/O channel index of the device.
- idxNode – Node index.
- pmin – Minimum settable value.
- pmax – Maximum settable value.
- pnSteps – Number of steps between minimum and maximum values.
FDwfAnalogIOChannelNodeSet(
HDWF hdwf, int idxChannel, int idxNode, double value)
Description: Sets the node value for the specified node on the specified channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxNode – Node index.
- idxChannel – Analog I/O channel index of the device.
- value – Value to set.
FDwfAnalogIOChannelNodeGet(
HDWF hdwf, int idxChannel, int idxNode, double *pvalue)
Description: Returns the currently set value of the node on the specified channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Analog I/O channel index of the device.
- idxNode – Node index.
- pvalue – Pointer to variable to return the configured value.
FDwfAnalogIOChannelNodeStatusInfo(
HDWF hdwf, int idxChannel, int idxNode, double *pmin, double *pmax, int
*pnSteps)
Description: Returns node the range of reading values available for the specified node on the specified channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- idxNode – Node index.
- pmin – Minimum reading value.
- pmax – Maximum reading value.
- pnSteps – Number of steps between minimum and maximum values.
FDwfAnalogIOChannelNodeStatus(
HDWF hdwf, int idxChannel, int idxNode, double *pvalue)
8 Digital I/O
The digital IO signals are shared in the device between Digital-IO, Out and In functions. The Digital-IO has priority
over Digital-Out. The Digital-Out is only applied for a signal when the Digital-IO Enable and Output are zero for the
respective bit.
FDwfDigitalIOReset(HDWF hdwf)
Description: Resets and configures (by default, having auto configure enabled) all DigitalIO instrument parameters
to default values. It sets the output enables to zero (tri-state), output value to zero, and configures
the DigitalIO instrument.
Parameters:
- hdwf – Open interface handle on a device.
FDwfDigitalIOConfigure(HDWF hdwf)
Description: Configures the DigitalIO instrument. This doesn’t have to be used if AutoConfiguration is enabled.
Parameters:
- hdwf – Open interface handle on a device.
FDwfDigitalIOStatus(HDWF hdwf)
Description: Reads the status and input values, of the device DigitalIO to the PC. The status and values are
accessed from the FDwfDigitalIOInputStatus function.
Parameters:
- hdwf – Open interface handle on a device.
FDwfDigitalIOOutputEnableInfo(HDWF hdwf,
unsigned long long *pfsOutputEnableMask)
Description: Returns the output enable mask (bit set) that can be used on this device. These are the pins that can
be used as outputs on the device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutputEnableMask – Variable to return the OE mask bit field.
Description: Enables specific pins for output. This is done by setting bits in the fsOutEnable bit field (1 for enabled,
0 for disabled).
Parameters:
- hdwf – Open interface handle on a device.
- fsOutputEnable – Output enable bit set.
Description: Returns a bit field that specifies which output pins have been enabled.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutputEnable – Pointer to variable to returns output enable bit set.
Description: Returns the settable output value mask (bit set) that can be used on this device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutputMask – Variable to return the output value mask.
Description: Returns the currently set output values across all output pins.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutput – Pointer to variable to returns output bit set.
Description: returns the readable input value mask (bit set) that can be used on the device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsInputMask – Variable to return the input value mask.
Description: Returns the input states of all I/O pins. Before calling the function above, call the
FDwfDigitalIOStatus function to read the Digital I/O states from the device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsInput – Variable to return the input value.
Description: Returns the settable output pullup and down mask that can be used on this device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsUp – Variable to return the pullup value mask.
- pfsDown – Variable to return the puldown value mask.
Description: Returns the currently set output values across all output pins.
Parameters:
- hdwf – Open interface handle on a device.
- pfsUp– Pointer to variable to returns pullup bit set.
- pfsDown – Pointer to variable to returns pulldown bit set.
Description: Returns information about the settable drive current and slew that can be used on this device
channels.
Parameters:
- hdwf – Open interface handle on a device.
- channel – Channel index, not yet used by any device.
- ampMin – Variable to return the minimum drive value in ampere.
- ampMax – Variable to return the maximum drive value in ampere.
- ampSteps – Variable to return the supported drive steps.
- slewSteps – Variable to return the supported slew steps.
Description: Returns the currently set output values across all output pins.
Parameters:
- hdwf – Open interface handle on a device.
- pamp– Pointer to variable to return drive.
- pslew – Pointer to variable to return slew.
Description: Returns the output enable mask (bit set) that can be used on this device. These are the pins that can
be used as outputs on the device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutputEnableMask – Variable to return the OE mask bit field.
Description: Enables specific pins for output. This is done by setting bits in the fsOutEnable bit field (1 for enabled,
0 for disabled).
Parameters:
- hdwf – Open interface handle on a device.
- fsOutputEnable – Output enable bit set.
Description: Returns a bit field that specifies which output pins have been enabled.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutputEnable – Pointer to variable to returns output enable bit set.
Description: Returns the settable output value mask (bit set) that can be used on this device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutputMask – Variable to return the output value mask.
Description: Returns the currently set output values across all output pins.
Parameters:
- hdwf – Open interface handle on a device.
- pfsOutput – Pointer to variable to returns output bit set.
Description: returns the readable input value mask (bit set) that can be used on the device.
Parameters:
- hdwf – Open interface handle on a device.
- pfsInputMask – Variable to return the input value mask.
Description: Returns the input states of all I/O pins. Before calling the function above, call the
FDwfDigitalIOStatus function to read the Digital I/O states from the device.
For Digital Discovery returns DIN[23-0] DIO[39-24]
Parameters:
- hdwf – Open interface handle on a device.
- pfsInput – Variable to return the input value.
Reconfigure?
Ready Configur Armed
e
Start? Start?
Trigger?
Prefill
Done Running
9.1 Control
FDwfDigitalInReset(HDWF hdwf)
Description: Resets and configures (by default, having auto configure enabled) all DigitalIn instrument parameters
to default values.
Parameters:
- hdwf – Interface handle.
Description: Configures the instrument and start or stop the acquisition. To reset the Auto trigger timeout, set
fReconfigure to TRUE.
Parameters:
- hdwf – Interface handle.
- fReconfigure – Configure the device.
- fStart – Start the acquisition.
Description: Checks the state of the instrument. To read the data from the device, set fReadData to TRUE. For
single acquisition mode, the data will be read only when the acquisition is finished.
Parameters:
- hdwf – interface handle.
- fReadData – TRUE if data should be read.
- psts – Variable to receive the acquisition state.
Description: Retrieves the buffer write pointer. This is needed in ScanScreen acquisition mode to display the scan
bar.
Parameters:
- hdwf – Interface handle.
- pidxWrite – Variable to receive the position of the acquisition.
FDwfDigitalInStatusTime(HDWF hdwf,
unsigned int * psecUtc, unsigned int * ptick, unsigned int * pticksPerSecond)
Description: It copies the data samples to the provided buffer. The sample format is specified by
FDwfDigitalInSampleFormatSet function.
Parameters:
- hdwf – Interface handle.
- rgData – Pointer to allocated buffer to copy the acquisition data.
- countOfDataBytes – Number of bytes to copy.
FDwfDigitalInStatusData2(HDWF hdwf,
void *rgData, int idxSample, int countOfDataBytes)
Description: It copies the data samples to the provided buffer. The sample format is specified by
FDwfDigitalInSampleFormatSet function.
Parameters:
- hdwf – Interface handle.
- rgData – Pointer to allocated buffer to copy the acquisition data.
- idxSample – First sample index to copy.
- countOfDataBytes – Number of bytes to copy.
FDwfDigitalInStatusNoise2(HDWF hdwf,
void *rgData, int idxSample, int countOfDataBytes)
FDwfDigitalInStatusRecord(
HDWF hdwf, int *pcdDataAvailable, int *pcdDataLost, int *pcdDataCorrupt)
Description: Retrieves information about the recording process. The data loss occurs when the device acquisition
is faster than the read process to PC. In this case, the device recording buffer is filled and data
samples are overwritten. Corrupt samples indicate that the samples have been overwritten by the
acquisition process during the previous read. In this case, try optimizing the loop process for faster
execution or reduce the acquisition frequency or record length to be less than or equal to the device
buffer size (record length <= buffer size/frequency).
Parameters:
- hdwf – Interface handle.
- pcdDataAvailable – Pointer to variable to receive the available number of samples.
- pcdDataLost – Pointer to variable to receive the lost samples after the last check.
- pcdDataCorrupt – Pointer to variable to receive the number of samples that could be corrupt.
9.2 Configuration
Description: Returns the supported clock sources for Digital In instrument. They are returned (by reference) as a
bit field. This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the
DwfDigitalInClockSource constants in dwf.h:
• DwfDigitalInClockSourceInternal: Internal clock.
• DwfDigitalInClockSourceExternal: External clock source.
Parameters:
- hdwf – Open interface handle on a device.
- pfsDwfDigitalInClockSource – Pointer to variable to return the available clock source options.
Description: Returns the maximum supported clock divider value. This specifies the sample rate.
Parameters:
- hdwf –Interface handle.
- pdivMax – Pointer to variable to return the available maximum divider value.
Description: Configures the order of values stored in the sampling array. If fDIOFirst = true DIO24..39 are placed at
the beginning of the array followed by DIN0..23. With fDIOFirst = false DIN0..23 are placed at the
beginning followed by DIO24..31. Valid only for Digital Discovery device.
Parameters:
- hdwf – Interface handle.
- fDioFirst – DIO or DIN lines start from index zero.
Description: Sets the sample format, the number of bits starting from least significant bit. Valid options are 8, 16,
and 32.
Parameters:
- hdwf – Interface handle.
- nBits – Sample format.
Description: Returns the supported sample modes. They are returned (by reference) as a bit field. This bit field can
be parsed using the IsBitSet Macro. Individual bits are defined using the DwfDigitalInSampleMode
constants in dwf.h:
• DwfDigitalInSampleModeSimple: Stores one sample on every divider clock pulse.
• DwfDigitalInSampleModeNoise: Stores alternating noise and sample values, where noise is more
than one transition between two samples. This could indicate glitches or ringing. It is available when
sample rate is less than maximum clock frequency, divider is greater than one.
Parameters:
- hdwf – Interface handle.
- pfsDwfDigitalInSampleMode – Pointer to return the supported sample modes.
- Description: Returns the supported DigitalIn acquisition modes. They are returned (by reference) as a bit field.
This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the ACQMODE constants
in DWF.h. The acquisition mode selects one of the following modes, ACQMODE:
Parameters:
- hdwf – Interface handle.
Description: Selects the signals to be used for data compression in record acquisition mode.
Parameters:
- hdwf – Interface handle.
- fs – bit field set of signals to look for compression.
Description: Retrieves the signals being used for data compression in record acquisition mode.
Parameters:
- hdwf – Interface handle.
- pfs – Pointer to variable to receive configured value
Description: Returns the maximum supported device buffers (memory segmentation) for acqmodeSingle,
Oversample for low latency sequential captures.
Parameters:
- hdwf – Interface handle.
- pnMax – Pointer to return the maximum buffers.
9.3 Trigger
Description: Gets the current trigger source setting for the instrument.
Parameters:
- hdwf – Interface handle.
- ptrigsrc – Pointer to variable to receive the trigger source.
Description: Gets the current trigger source setting for the instrument.
Parameters:
- hdwf – Interface handle.
- pslope – Pointer to variable to receive the trigger slope.
FDwfDigitalInTriggerPositionInfo(
HDWF hdwf, unsigned int *pnSamplesAfterTriggerMax)
Description: Returns maximum values of the trigger position in samples. This can be greater than the specified
buffer size.
Parameters:
- hdwf – Interface handle.
- pnSamplesAfterTriggerMax – Variable to receive the maximum trigger position.
FDwfDigitalInTriggerPositionGet(
HDWF hdwf, unsigned int *pcSamplesAfterTrigger)
Description: Sets the number of samples to acquire before arming in Record acquisition mode. The prefill is used
for record with trigger to make sure at last the required number of samples are collected before
arming, before looking for trigger event.
With prefill 0 the recording process will stream data only after trigger event.
With prefill more than zero the recording will stream until trigger occurs plus the samples specified
by trigger position.
Parameters:
- hdwf – Interface handle.
- cSamplesBeforeTrigger – Samples before trigger.
FDwfDigitalInTriggerPrefillGet(
HDWF hdwf, unsigned int *pcSamplesBeforeTrigger)
FDwfDigitalInTriggerAutoTimeoutInfo(
HDWF hdwf, double *psecMin, double *psecMax, double *pnSteps)
Description: Returns the minimum and maximum auto trigger timeout values, and the number of adjustable steps.
Parameters:
- hdwf – Interface handle.
- psecMin – Variable to receive the minimum timeout.
- psecMax – Variable to receive the maximum timeout.
- pnSteps – Variable to return the number of steps.
Description: Returns the configured auto trigger timeout value in seconds. The acquisition is auto triggered when
the specified time elapses. With zero value the timeout is disabled, performing “Normal” acquisitions.
Parameters:
- hdwf – Interface handle.
- psecTimeout – Variable to receive the current timeout.
FDwfDigitalInCounterStatus(HDWF hdwf,
double *pcnt, double *pfreq, double *ptick)
In order to use trigger on digital in pins, set trigger source with FDwfDigitalInTriggerSourceSet to
trigsrcDetectorDigitalIn.
FDwfDigitalInTriggerInfo(HDWF hdwf,
unsigned int *pfsLevelLow, unsigned int *pfsLevelHigh,
unsigned int *pfsEdgeRise, unsigned int *pfsEdgeFall)
Description: Returns the supported digital in triggers. The bits of the arguments represent pins.
Parameters:
- hdwf – Interface handle.
- pfsLevelLow – Variable to receive the supported low state triggers.
- pfsLevelHigh – Variable to receive the supported low state triggers.
- pfsEdgeRise – Variable to receive the supported rising edge triggers.
- pfsEdgeFall – Variable to receive the supported falling edge triggers.
FDwfDigitalInTriggerSet(HDWF hdwf,
unsigned int fsLevelLow, unsigned int fsLevelHigh,
unsigned int fsEdgeRise, unsigned int fsEdgeFall)
FDwfDigitalInTriggerGet(HDWF hdwf,
unsigned int *pfsLevelLow, unsigned int *pfsLevelHigh,
unsigned int *pfsEdgeRise, unsigned int *pfsEdgeFall)
FDwfDigitalInTriggerResetSet(HDWF hdwf,
unsigned int fsLevelLow, unsigned int fsLevelHigh,
unsigned int fsEdgeRise, unsigned int fsEdgeFall)
FDwfDigitalInTriggerLengthSet(HDWF hdwf,
double secMin, double secMax, int idxSync)
Description: Configures the trigger timing. The synchronization modes are the following :
0 – Normal
1 – Timing: use for UART, CAN. The min length specifies bit length and max the timeout length.
2 – PWM: use for 1-Wire. The min length specifies sampling time and max the timeout length.
Parameters:
- hdwf – Interface handle.
- secMin – Set minimum length in seconds, up to 20sec.
- secMax – Set maximum length in seconds, up to 20sec.
- idxSync – Set synchronization mode.
FDwfDigitalInTriggerMatchSet(HDWF hdwf,
int iPin, unsigned int fsMask, unsigned int fsValue, int cBitStuffing)
Description: Configure the deserializer. The bits are left shifted. The mask and value should be specified according
to this, in MSBit first order. Like to trigger on first to fourth bits received from a sequence of 8,
b1010XXXX, set mask to 0x000000F0 and value to 0x000000A0.
Parameters:
- hdwf – Interface handle.
- iPin – Set pin to deserialize.
- fsMask – Set bit mask pattern.
- fsValue – Set bit match pattern.
- cBitStuffing – Set bit stuffing count.
Timeout: To trigger on pulse timeout, on a pulse after the specified minimum time expires:
FDwfDigitalInTriggerLengthSet(hdwf, min, 0, 0); // minimum pulse length in seconds
More: To trigger on pulse ending slope which is longer than the specified minimum time:
FDwfDigitalInTriggerLengthSet(hdwf, min, -1, 0); // minimum pulse length in seconds
Length: To trigger on a pulse length with the specified minimum and maximum lengths use:
FDwfDigitalInTriggerLengthSet(hdwf, min, max, 0); // min/max pulse length in seconds
Start? Trigger?
Ready Armed Wait
Channel configuration:
Initial
Initial Low
Divider High
Clock Pulse
Expire 1
Divider Counter (Level)
(TS +2) Expire
1/2
Type
Random
Address 1/2
Custom
PP OS OD
TS(2)
OE
Mode IO
Running?
OE
IO
Idle
The initial values, for divider and counter, specify the initially loaded values, initial delay, when entering in Running
state. The Divider specifies the clock division. This rate will be the custom sample frequency and step for the
counter. When entering Running state, the initial value specified with FDwfDigitalOutDividerInitSet is loaded.
When this expires, the value specified by FDwfDigitalOutDividerSet will be loaded upon each expiration.
The Counter initial value is set by FDwfDigitalOutCounterInitSet function. This function also sets the initial level.
When this expires the level values specified by FDwfDigitalOutCounterSet are loaded upon further expiration. On
counter expiration the level is toggled, and this directs the low or high value loading. In case one of these is zero,
the level is not toggled.
The output Mode (FDwfDigitalOutOutputSet) selects between: PP, OS, OD and TS.
The Idle output (FDwfDigitalOutIdleSet) selects the output while not in Running state.
Pulse signal:
Triggered/Running state
Divider
For pulse signal the initial level and initial value are specified with FDwfDigitalOutCounterInitSet function. These
are loaded when entering Running state.
10.1 Control
FDwfDigitalOutReset(HDWF hdwf)
Description: Resets and configures (by default, having auto configure enabled) all the instrument parameters to
default values.
Parameters:
- hdwf – Interface handle.
10.2 Configuration
Description: Sets the trigger source for the instrument. Default setting is trigsrcNone.
Parameters:
- hdwf – Interface handle.
- trigsrc – Trigger source to set.
Description: Gets the current trigger source setting for the instrument.
Parameters:
- hdwf – Interface handle.
- ptrigsrc – Pointer to variable to receive the trigger source.
Description: Gets the current trigger source setting for the instrument.
Parameters:
- hdwf – Interface handle.
- pslope – Pointer to variable to receive the trigger slope.
Description: Returns the supported run length range for the instrument in seconds. Zero value (default) represent
an infinite (or continuous) run.
Parameters:
- hdwf – Interface handle.
- psecMin – Variable to receive the supported minimum run length.
- psecMax – Variable to receive the supported maximum run length.
Description: Reads the configured run length for the instrument in seconds.
Parameters:
- hdwf – Interface handle.
- psecRun – Pointer to variable to receive the run length.
Description: Reads the remaining run length. It returns data from the last FDwfDigitalOutStatus call.
Parameters:
- hdwf – Interface handle.
- psecRun – Pointer to variable to receive the remaining run length.
Description: Returns the supported wait length range in seconds. The wait length is how long the instrument waits
after being triggered to generate the signal. Default value is zero.
Parameters:
- hdwf – Interface handle.
- psecMin – Variable to receive the supported minimum wait length.
- psecMax – Variable to receive the supported maximum wait length.
Description: Returns the supported repeat count range. This is how many times the generated signal will be
repeated. Zero value represents infinite repeats. Default value is one.
Parameters:
- hdwf – Interface handle.
- pnMin – Variable to receive the supported minimum repeat count.
- pnMax – Variable to receive the supported maximum repeat count.
Description: Reads the remaining repeat counts. It only returns information from the last FDwfDigitalOutStatus
function call, it does not read from the device.
Parameters:
- hdwf – Interface handle.
- pcRepeat – Pointer to variable to receive the remaining repeat counts.
Description: Sets the repeat trigger option. To include the trigger in wait-run repeat cycles, set fRepeatTrigger to
TRUE. It is disabled by default.
Parameters:
- hdwf – Interface handle.
- fRepeatTrigger – Boolean used to specify if the trigger should be included in a repeat cycle.
Description: Verifies if the trigger has been included in wait-run repeat cycles.
Parameters:
- hdwf – Open interface handle on a device.
- pfRepeatTrigger – Pointer to variable to receive the repeat trigger option.
Description: Returns the number of Digital Out channels by the device specified by hdwf.
Parameters:
- hdwf – Interface handle.
- pcChannel – Pointer to variable to receive the number of channels in the instrument.
FDwfDigitalOutOutputInfo(
HDWF hdwf, int idxChannel, int *pfsDwfDigitalOutOutput)
Description: Returns the supported output modes of the channel. They are returned (by reference) as a bit field.
This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the
DwfDigitalOutOutput constants in DWF.h:
• DwfDigitalOutOutputPushPull: Default setting.
• DwfDigitalOutOutputOpenDrain: External pull needed.
• DwfDigitalOutOutputOpenSource: External pull needed.
• DwfDigitalOutOutputThreeState: Available with custom and random types.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pfsDwfDigitalOutOutput – Pointer to variable to receive the supported output modes.
Description: Returns the supported types of the channel. They are returned (by reference) as a bit field. This bit
field can be parsed using the IsBitSet Macro. Individual bits are defined using the DwfDigitalOutType
constants in dwf.h:
• DwfDigitalOutTypePulse: Frequency = internal frequency/divider/(low + high counter).
• DwfDigitalOutTypeCustom: Sample rate = internal frequency / divider.
• DwfDigitalOutTypeRandom: Random update rate = internal frequency/divider/counter
alternating between low and high values.
• DwfDigitalOutTypeROM: ROM logic, the DIO input value is used as address for output value
• DwfDigitalOutTypeState: similar to ROM logic but uses internal loopback and no output
• DwfDigitalOutTypePlay: Supported with Digital Discovery.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pfsDwfDigitalOutType – Pointer to variable to receive the supported output types.
Description: Returns the supported idle output types of the channel. They are returned (by reference) as a bit
field. This bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the
DwfDigitalOutIdle constants in dwf.h. Output while not running:
• DwfDigitalOutIdleInit: Output initial value.
• DwfDigitalOutIdleLow: Low level.
• DwfDigitalOutIdleHigh: High level.
• DwfDigitalOutIdleZet: Three state.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pfsDwfDigitalOutIdle – Pointer to variable to receive the supported idle output types.
FDwfDigitalOutDividerInfo(
HDWF hdwf, int idxChannel, unsigned int *vMin, unsigned int *vMax)
FDwfDigitalOutCounterInfo(
HDWF hdwf, int idxChannel, unsigned int *vMin, unsigned int *vMax)
FDwfDigitalOutCounterInitSet(
HDWF hdwf, int idxChannel, int fHigh, unsigned int v)
Description: Sets the initial state and counter value of the specified channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- fHigh – Start high.
- v – Counter initial value.
FDwfDigitalOutCounterInitGet(
HDWF hdwf, int idxChannel, int *pfHigh, unsigned int *pv)
Description: Retrieves the initial state and counter value for the specified channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pfHigh – Pointer to variable to receive configured value.
- pv – Pointer to variable to receive configured value.
FDwfDigitalOutCounterSet(
HDWF hdwf, int idxChannel, unsigned int vLow, unsigned int vHigh)
Description: Sets the counter low and high values for the specified channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- vLow – Counter low value.
- vHigh – Counter high value.
FDwfDigitalOutCounterGet(
HDWF hdwf, int idxChannel, unsigned int *pvLow, unsigned int *pvHigh)
Description: Verifies the low and high counter value of the specified channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pvLow – Pointer to variable to receive configured value.
- pvHigh – Pointer to variable to receive configured value.
Repetition specifies how many times the counter should be reloaded. For pulse signals set twice the desired value
since each pulse is generated by two counter loads, low and high.
It is available with ADP3X50 and newer devices.
Description: Sets the counter low and high values for the specified channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- cRepeat – Repetition value for low and high counts. Use twice the repeat for pulse, like 2 to repeat once.
Description: Verifies the low and high counter value of the specified channel.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pvLow – Pointer to variable to receive configured value.
- pvHigh – Pointer to variable to receive configured value.
FDwfDigitalOutDataInfo(
HDWF hdwf, int idxChannel, unsigned int *pcountOfBitsMax)
Description: Returns the maximum buffers size, the number of custom data bits.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pcountOfBitsMax – Variable to receive the maximum number of bits.
FDwfDigitalOutDataSet(
HDWF hdwf, int idxChannel, void *rgBits, unsigned int countOfBits)
Description: Sets the custom data bits. The function also sets the counter initial, low and high value, according the
number of bits. The data bits are sent out in LSB first order. For TS output, the count of bits is the total number of
output value (I/O) and output enable (OE) bits, which should be an even number.
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgBits – Custom data array.
- countOfBits –Number of bits.
Description: Sets the data bits to play. The output can be DwfDigitalOutOutputPushPull, OpenDrain or
OpenSource. ThreeState is not supported.
Parameters:
- hdwf – Interface handle.
- rgBits – Data array to play.
- bitPerSample – Bits per sample, should be 1, 2, 4, 8 or 16. The expected bit order in rgBits:
1: rgBits[DIO-0-S0, DIO-0-S1, DIO-0-S2, …]
2: rgBits[DIO-0-S0, DIO-1-S0, DIO-0-S1, DIO-1-S1, …]
4: rgBits[DIO-0-S0, DIO-1-S0, DIO-2-S0, DIO-3-S0, DIO-0-S1, DIO-1-S1, DIO-2-S1, DIO-3-S1, …]
8: rgBits[DIO-0-S0, DIO-1-S0,…, DIO-7-S0, DIO-0-S1, DIO-1-S1, …, DIO-7-S1, …]
16: rgBits[DIO0-S0, DIO-1-S0,…, DIO-15-S0, DIO-0-S1, DIO-1-S1, …, DIO-15-S1, …]
- countOfSamples – Number of samples
11 Miscellaneous
Description: Peforms FFT on data array and returns BINs and/or Phase.
Parameters:
- rgdData – Data array input.
- cdData – Data array size. It should be power of two number, otherwise
- rgdBin – BIN array output in peak voltage unit (optional). DC to rate/2 with rate/2/(cdBin-1) resolution
- rgdPase – Phase array output in radian unit (optional).
- cdBin – BIN and Phase array size. It must be cdData/2+1.
Description: Peforms FFT or CZT on data array and returns BINs and/or Phase.
Parameters:
- rgdData – Data array input.
- cdData – Data array size.
- rgdBin – BIN array output in peak voltage unit (optional). For dBV use 20*log10(BIN/sqrt(2))
- rgdPase – Phase array output in radian unit (optional).
- cdBin – BIN and Phase array size.
- iFirst – Start of frequency domain, between 0 and 1 interpreted as DC and sample rate/2.
- iLast – End of frequency domain, between 0 and 1 interpreted as DC to sample rate/2.
Like for 100MHz sample rate: for 0.0 and 1.0 will output 0Hz to 50MHz; 0.1 and 0.5 output 5MHz to 25MHz
12 Analog Impedance
The Analog Impendace functions use the Analog Input and Output channel 1.
When used with Imepdance Analyzer module the Analog IO (Power Supplies) and Digital IO will be used too.
These functions can be used with Impedance Analyzer for Analog Discovery (specify this with value 8 in
FDwfAnalogImpedanceModeSet function) or the analyzer circuit can be constructed in the following ways:
The DUT (Device Under Test) stands for the inductive or capacitive load to be analyzed and Resistor is the
reference resistor. The resistor value depends on the load value and frequency.
FDwfAnalogImpedanceReset(HDWF hdwf)
Description: Configures the stimulus signal amplitude, half of the peak to peak value.
Parameters:
- hdwf – Interface handle.
- volts – Amplitude value.
Description: Specifies the probe impedance that will be taken in consideration for measurements.
The default values are set specific for device when calling the FDwfAnalogImpedanceReset function.
Parameters:
- hdwf – Interface handle.
- ohmRes – Probe resistance.
- faradCap – Probe capacitance.
FDwfAnalogImpedanceCompReset(HDWF hdwf)
FDwfAnalogImpedanceCompSet(HDWF hdwf,
double ohmOpenResistance, double ohmOpenReactance,
double ohmShortResistance, double ohmShortReactance)
Description: Specifies the open and short compensation parameters. These values are specific for the
circuit/adapter.
Parameters:
- hdwf – Interface handle.
- ohmOpenResistance – Open resistance value.
- ohmOpenReactance – Open reactance value.
- ohmShortResistance – Short resistance value.
- ohmShortReactance – Short reactance value.
FDwfAnalogImpedanceCompGet(HDWF hdwf,
double *pohmOpenResistance, double *pohmOpenReactance,
double *pohmShortResistance, double *pohmShortReactance)
FDwfAnalogImpedanceStatusInput(HDWF hdwf,
int idxChannel, double *pgain, double *pradian)
Description: Read the raw input, for network analysis purpose. This returns the raw values without taking in
consideration the probe characteristics or compensation parameters.
For scope channel 1 (idxChannel = 0) the gain is relative to Wavegen amplitude (Ampltiude/Channel1)
and the phase is zero. For further channels the gain and phase is relative to channel 1, gain = C1/C#
The gain value is dimensionless, it represents the V/V ratio.
Parameters:
- hdwf – Interface handle.
- idxChannel – Scope channel index.
- pgain – Pointer to variable to receive the gain.
- pradian – Pointer to variable to receive the phase.
Description: This returns the warning if the scope input range is exceeded.
Parameters:
- hdwf – Interface handle.
- idxChannel – Scope channel index.
- pWarning– Pointer to variable to receive the warning status, 1 low, 2 high, 3 both.
FDwfAnalogImpedanceStatusMeasure(HDWF hdwf,
DwfAnalogImpedance measure, double *pvalue)
Description: Read the DUT measurements. These take in account the scope probe characteristics and
compensation parameters.
13 Digital Protocols
The protocols use the Digital-In/Out device resources to create various communication protocols. Only one of the
protocols can be used at a time. The Digital-Out is used to generate the output signals and the Digital-In to capture
the received data. Overriding a signal used by the protocol with Digital-IO may mess up the communication.
Note:
The DIO channe indexing for Digital Discovery starts from 0, 0 is DIO-24, 1 is DIO-25…
13.1 UART
See Digital_Uart.py example.
FDwfDigitalUartReset(HDWF hdwf)
Description: Resets the UART configuration to default value. Use FDwfDigitalOutReset to reset the output.
Parameters:
- hdwf – Interface handle.
Description: Sets the parity bit: 0 no parity, 1 even, 2 odd, 3 mark (high), 4 space (low)
Parameters:
- hdwf – Interface handle.
- parity – parity mode to set
FDwfDigitalUartRx(HDWF hdwf, char *szRx, int cRxMax, int *pcRx, int *pParity)
Description: Initializes the reception with cRxMax zero. Otherwise returns the received characters since the last
call.
Parameters:
- hdwf – Interface handle.
- szRX – buffer to receive characters
- cRxMax – the maximum number of characters to receive, the buffer size
- pcRX – pointer to return the number of characters received
- pParity – pointer to return:
- negative value for buffer overflow, in case the buffer got full since the previos call of this function
- the first parity check failure as one based index
- zero for no error
13.2 SPI
See examples: Digital_Spi.py, Digital_Spi_Dual.py, Digital_Spi_Quad.py, Digital_Spi_Siso.py
The Select signal is controlled automatically for transfer funnctions if it is configured by the FDwfDigitalSpiSelectSet
and it is not activated with the FDwfDigitalSpiSelect, having the same DIO and active level.
FDwfDigitalSpiReset(HDWF hdwf)
Description: Resets the SPI configuration to default value. Use FDwfDigitalOutReset to reset the outputs.
Parameters:
- hdwf – Interface handle.
Description: Specifies the DQ singal idle output state. DQ2 and 3 may be used for alternative purpose like for write
protect (should driven low) or for hold (should be in high impendance).
Parameters:
- hdwf – Interface handle.
- idxDQ – specify data index
- idle – idle state of the channel
FDwfDigitalSpiDelaySet(HDWF hdwf, int cStart, int cCmd, int cWord, int cStop)
Description: Performs SPI transfer of up to 8bit words. This function is intended for standard MOSI/MISO (cDQ 1)
operations, but it can be used for other modes as long only write (rgTX/cTX) or read (rgRX/cRX) is
specified.
The number of clock signals generated is the maximum of cTX and cRX.
Parameters:
- hdwf – Interface handle.
- cDQ – specify the DQ lines to use to transfer data:
cDQ
0 SISO use only DQ0 for read and write
1 MOSI/MISO use DQ0 for write and DQ1 to read data
2 DUAL use DQ0 for even and DQ1 for odd bits
3 QUAD use DQ0 for 0,4,8…, DQ1 for 1,5,9…, DQ2 for 2,6,10…, DQ3 for 3,7,11… data bits
- cBitPerWord – specify the number of bits to transfer for each word.
- rgTX – array of 8bit values (byte words) to write.
- cTX – number of words to write.
- rgRx – buffer for read words.
- cRx – number of words to read.
Description: Performs SPI transmit of up to 32 bits. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – Specify the DQ lines to use to transfer data.
- cBits – Specify the number of bits to transmit.
- vTX – Specify the data to transmit.
Description: Performs SPI reception of up to 32 bits. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – Specify the DQ lines to use to transfer data.
- cBits – Specify the number of bits to receive.
- pRX – Pointer to variable to return the received bits.
Description: Performs SPI transmission of up to 8-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgTX – Array of 8-bit values (words) to transmit.
- cTX – Number of words to transmit.
Description: Performs SPI reception of up to 8-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgRx – Buffer for receive words.
- cRx – Number of words to received.
Description: Performs SPI transfer of up to 16-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgTX – Array of 16bit values (words) to transmit.
- cTX – Number of words to transmit.
- rgRx – Buffer for read words.
- cRx – Number of words to read.
Description: Performs SPI transfer of up to 32-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgTX – Array of 32bit values (words) to write.
- cTX – Number of words to write.
- rgRx – Buffer for read words.
- cRx – Number of words to read.
Description: Performs SPI read of up to 16-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgRx – buffer for read words.
- cRx – number of words to read.
Description: Performs SPI read of up to 32-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgRx – buffer for read words.
- cRx – number of words to read.
Description: Performs SPI read of up to 16-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgTX – array of 16-bit values (words) to write.
- cTX – number of words to write.
Description: Performs SPI read of up to 32-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgTX – array of 32-bit values (int) to write.
- cTX – number of bytes to write.
FDwfDigitalSpiCmdWriteRead(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord,
unsigned char *rgTX, int cTX, unsigned char *rgRX, int cRX)
Description: Performs SPI transfer of up to 8bit words. This function is intended for standard MOSI/MISO (cDQ 1)
operations, but it can be used for other modes as long only write (rgTX/cTX) or read (rgRX/cRX) is
specified. The number of clock signals generated is the maximum of cTX and cRX.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – Specify the DQ lines to use to transfer data
- cBitPerWord – specify the number of bits to transfer for each word.
- rgTX – array of 8bit values (byte words) to write.
- cTX – number of words to write.
- rgRx – buffer for read words.
- cRx – number of words to read.
FDwfDigitalSpiCmdWriteOne(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBits, unsigned int vTX)
Description: Performs SPI transmit of up to 32 bits. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – Specify the DQ lines to use to transfer data.
- cBits – Specify the number of bits to transmit.
- vTX – Specify the data to transmit.
FDwfDigitalSpiCmdReadOne(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBits, unsigned int *pRX)
Description: Performs SPI reception of up to 32 bits. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – Specify the DQ lines to use to transfer data.
- cBits – Specify the number of bits to receive.
- pRX – Pointer to variable to return the received bits.
FDwfDigitalSpiCmdWrite(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord,
unsigned char *rgTX, int cTX)
Description: Performs SPI transmission of up to 8-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgTX – Array of 8-bit values (words) to transmit.
- cTX – Number of words to transmit.
FDwfDigitalSpiCmdRead(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord, unsigned char *rgRX, int cRX)
Description: Performs SPI reception of up to 8-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgRx – Buffer for receive words.
- cRx – Number of words to received.
FDwfDigitalSpiCmdWriteRead16(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord,
unsigned short *rgTX, int cTX, unsigned short *rgRX, int cRX)
Description: Performs SPI transfer of up to 16-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgTX – Array of 16bit values (words) to transmit.
- cTX – Number of words to transmit.
- rgRx – Buffer for read words.
- cRx – Number of words to read.
FDwfDigitalSpiCmdWriteRead32(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord,
unsigned int *rgTX, int cTX, unsigned int *rgRX, int cRX)
Description: Performs SPI transfer of up to 32-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – Specify the DQ lines to use to transfer data.
- cBitPerWord – Specify the number of bits to transfer for each word.
- rgTX – Array of 32bit values (words) to write.
- cTX – Number of words to write.
- rgRx – Buffer for read words.
- cRx – Number of words to read.
FDwfDigitalSpiCmdRead16(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord, unsigned short *rgRX, int cRX)
Description: Performs SPI read of up to 16-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgRx – buffer for read words.
- cRx – number of words to read.
FDwfDigitalSpiCmdRead32(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord, unsigned int *rgRX, int cRX)
Description: Performs SPI read of up to 32-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgRx – buffer for read words.
- cRx – number of words to read.
FDwfDigitalSpiCmdWrite16(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord, unsigned short *rgTX, int cTX)
Description: Performs SPI read of up to 16-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgTX – array of 16-bit values (words) to write.
- cTX – number of words to write.
FDwfDigitalSpiCmdWrite32(HDWF hdwf,
int cBitCmd, unsigned char cmd, int cDummy,
int cDQ, int cBitPerWord, unsigned int *rgTX, int cTX)
Description: Performs SPI read of up to 32-bit words. See FDwfDigitalSpiWriteRead for more information.
Parameters:
- hdwf – Interface handle.
- cBitCmd – specify the number of command bits.
- cmd – Specify command value
- cDummy – Specify the number of dummy bits before data transfer
- cDQ – specify the DQ lines to use to transfer data.
- cBitPerWord – specify the number of bits to transfer for each word.
- rgTX – array of 32-bit values (int) to write.
- cTX – number of bytes to write.
13.3 I2C
See Digital_I2c.py exampels.
FDwfDigitalI2cReset(HDWF hdwf)
Description: Verifies and tries to solve eventual bus lockup. The argument returns true, non-zero value if the bus is
free.
Parameters:
- hdwf – Interface handle.
- pfFree – pointer to return the
Description: Specifies if the last read byte should be acknowledged or not. The I2C specifications require NAK, this
parameter set to true.
Parameters:
- hdwf – Interface handle.
- fNakLastReadByte – value to set (default 1, true).
Description: Performs I2C write, repeated start and read. In case zero bytes are specified for read (cRx) only write
and for zero write (cTx) only read is peformed. The read/write bit in the address is controlled by the
function. The returned NAK index returns one based index of the first negative ackedged transfer
byte, zero when all the bytes where acknowledged. When the first address is acknowledged it returns
1. Returns negative value for other communication falures like timeout.
Parameters:
- hdwf – Interface handle.
- adr8bits – specify the address in 8-bit format, bAAAAAAAX.
- rgbTX – array of bytes to write.
- cTX – number of bytes to write.
- rgbRx – buffer for read bytes.
- cRx – number of bytes to read.
- pNak – pointer to variable to return eventual NAK index.
Description: Performs I2C read. See DwfDigitalI2cWriteRead function for more information.
Parameters:
- hdwf – Interface handle.
- adr8bits – specify the address.
- rgbRx – buffer for read bytes.
- cRx – number of bytes to read.
- pNak – pointer to variable to return eventual NAK index.
Description: Performs I2C write. See DwfDigitalI2cWriteRead function for more information.
Parameters:
- hdwf – Interface handle.
- adr8bits – specify the address.
- rgbTX – array of bytes to write.
- cTX – number of bytes to write.
- pNak – pointer to variable to return eventual NAK index.
Description: Performs I2C write of one byte. See DwfDigitalI2cWriteRead function for more information.
Parameters:
- hdwf – Interface handle.
- adr8bits – specify the address.
- bTX – bytes to write.
- pNak – pointer to variable to return eventual NAK index.
FDwfDigitalI2cSpyStart(HDWF hdwf)
FDwfDigitalI2cSpyStatus(HDWF hdwf,
int *fStart, int *fStop, unsigned char *rgData, int *cData, int *iNak)
Description: Decoded I2C communication. Active values are returned when when Stop is met, before ReStart or
the requested number of data is decoded.
See example: SDK/ samples/ py/ Digital_I2c_Spy.py
Parameters:
- hdwf – Interface handle.
- fStart – Rerturn 1 if start and 2 if restart was detected, otherwise 0.
- fStop – Rerturn 1 if stop was detected, otherwise 0.
- rgData – Buffer for data. First value is addres when fStart is not zero.
- cData – Specify the maximum number of data and returns the decoded words.
- iNak – Returns NAK index + 1. Negative values indicated error.
13.4 CAN
See Digital_Can.py example.
FDwfDigitalCanReset(HDWF hdwf)
Description: Resets the CAN configuration to default value. Use FDwfDigitalOutReset to reset the output.
Parameters:
- hdwf – Interface handle.
Description: Performs a CAN transmission. Specifying -1 for vID it initializes the TX channel.
Parameters:
- hdwf – Interface handle.
- vID – identifier.
- fExtended – 0 base frame, 1 extended frame; 11- or 29-bit identifier.
- fRemote – 0 data frame, 1 remote request.
- rgTX - array of data bytes to send.
Description: Returns the received frames since the last call. With cRX zero initializes the reception.
Parameters:
- hdwf – Interface handle.
- pvID – pointer to return the identifier.
- pfExtended - pointer to return the extended bit value.
- pfRemote – pointer to return the remote bit value.
- pcDLC – pointer to return the data length code.
- rgRX – poiter to array to return the data bytes.
- cRX - the maximum number of data bytes to receive, rgRX buffer size
- pvStatus – pointer to return the function status:
0 - nothing received.
1 – frame received without error.
2 – frame received with bit stuffing error.
3 – frame received with CRC error.
13.5 SWD
See Digital_Swd.py example.
FDwfDigitalSwdReset(HDWF hdwf)
Description: Resets the SWD configuration to default value. Use FDwfDigitalOutReset to reset the outputs and
FDwfDigitalSwdClear for SWD reset command!
Parameters:
- hdwf – Interface handle.
Description: Specifies the channel to use for clock signal, default DIO-0.
Parameters:
- hdwf – Interface handle.
- idxChannel – DIO channel to use for clock.
Description: Specifies the channel to use for data signal, default DIO-1.
Parameters:
- hdwf – Interface handle.
- idxChannel – DIO channel to use for data.
14 Devices
14.1 Electronics Explorer
The Electronics Explorer has nine AnalogIO channels. The master enable validates the power supplies and
reference voltages.
There are five configurations available for the device. See FDwfDeviceConfigOpen.
There are eight configurations available for the device. See FDwfDeviceConfigOpen.
Based on the FDwfDigitalInInputOrderSet and FDwfDigitalInSampleFormatSet the captured samples and the
configured FDwfDigitalInTriggerSet bits are as follows:
There are four configurations provided to support combinations of Zmod Scope/Digitizer (ADC) or
AWG (DAC) loaded in ZMOD A and B. The suitable configuration is automatically selected based on
the loaded Zmods.
Note that the software does not support combining Scope and Digitizer Zmods.
There are six configurations available for the device. See FDwfDeviceConfigOpen.
15 Deprecated functions
The following functions are replaced by FDwfAnalogOutNode *providing access to the Amplitude and Frequency
Modulation of Analog Out channels.
Description: Retrieves information about the play process. The data lost occurs when the device generator is faster
than the sample send process from the PC. In this case, the device buffer gets emptied and generated
samples are repeated. Corrupt samples are a warning that the buffer might have been emptied while
samples were sent to the device. In this case, try optimizing the loop for faster execution; or reduce
the frequency or run time to be less or equal to the device buffer size (run time <= buffer
size/frequency).
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- cdDataFree – Pointer to variable to return the available free buffer space, the number of new samples that can
be sent.
- cdDataLost – Pointer to variable to return the number of lost samples.
- cdDataCorrupted – Pointer to variable to return the number of samples that could be corrupted.
Description: Sends new data samples for play mode. Before starting the Analog Out instrument, prefill the device
buffer with the first set of samples using the AnalogOutDataSet function. In the loop of sending the
following samples, first call AnalogOutStatus to read the information from the device, then
AnalogOutPlayStatus to find out how many new samples can be sent, then send the samples with
AnalogOutPlayData.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- rgdData – Pointer to samples array to be sent to the device.
- cdData – Number of samples to send.
Description: Enables or disables the channel specified by idxChannel. With channel index -1, each Analog Out
channel enable will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- fEnable – TRUE to enable, FALSE to disable.
Description: Returns the supported generator function options. They are returned (by reference) as a bit field. This
bit field can be parsed using the IsBitSet Macro. Individual bits are defined using the FUNC constants
in dwf.h. These are:
Description: Sets the generator output function for the specified instrument channel. With channel index -1, each
enabled Analog Out channel function will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- func – Generator function option to set.
Description: Retrieves the current generator function option for the specified instrument channel.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- ptrigsrc – Pointer to variable to receive the generator function option.
FDwfAnalogOutFrequencyInfo(
HDWF hdwf, int idxChannel, double *phzMin, double *phzMax)
Description: Returns the supported frequency range for the instrument. The maximum value shows the DAC
frequency. The frequency of the generated waveform: repetition frequency for standard types and
custom data; DAC update for noise type; sample rate for play type.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- phzMin – Variable to receive the supported minimum frequency.
- phzMax – Variable to receive the supported maximum frequency.
Description: Sets the frequency. With channel index -1, each enabled Analog Out channel frequency will be
configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- hzFrequency – Frequency value to set expressed in Hz.
Description: Gets the currently set frequency for the specified channel on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- hzFrequency – Pointer to variable to receive frequency value in Hz.
FDwfAnalogOutAmplitudeInfo(
HDWF hdwf, int idxChannel, double *pvMin, double *pvMax)
Description: Retrieves the amplitude range for the specified channel on the instrument. The amplitude is
expressed in Volts units for carrier and in percentage units (modulation index) for AM/FM.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pvMin – Minimum amplitude level or modulation index.
- pvMax – Maximal amplitude level or modulation index.
Description: Sets the amplitude or modulation index for the specified channel on the instrument. With channel
index -1, each enabled Analog Out channel amplitude will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- vAmplitude – Amplitude of channel in Volts or modulation index in percentage.
Description: Gets the currently set amplitude or modulation index for the specified channel on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pvAmplitude – Pointer to variable to receive amplitude value in Volts or modulation index in percentage.
Description: Sets the offset value for the specified channel on the instrument. With channel index -1, each enabled
Analog Out channel offset will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- vOffset – Value to set voltage offset in Volts or modulation offset percentage.
Description: Gets the current offset value for the specified channel on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pvOffset – Pointer to variable to receive offset value in Volts or modulation offset percentage.
FDwfAnalogOutSymmetryInfo(
HDWF hdwf, int idxChannel, double *ppercentageMin, double *ppercentageMax)
Description: Obtains the symmetry (or duty cycle) range (0..100). This symmetry is supported for standard signal
types. It the pulse duration divided by the pulse period.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- ppercentageMin – Minimum value of Symmetry percentage.
- ppercentageMax – Maximum value of Symmetry percentage.
FDwfAnalogOutSymmetrySet(
HDWF hdwf, int idxChannel, double percentageSymmetry)
Description: Sets the symmetry (or duty cycle) for the specified channel on the instrument. With channel index -1,
each enabled Analog Out channel symmetry will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- percentageSymmetry –Value of percentage of Symmetry (duty cycle).
FDwfAnalogOutSymmetryGet(
HDWF hdwf, int idxChannel, double *ppercentageSymmetry)
Description: Gets the currently set symmetry (or duty cycle) for the specified channel of the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- ppercentageSymmetry –– Pointer to variable to receive value of symmetry (duty cycle).
FDwfAnalogOutPhaseInfo(
HDWF hdwf, int idxChannel, double *pdegreeMin, double *pdegreeMax)
Description: Retrieves the phase range (in degrees 0...360) for the specified channel of the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pdegreeMin – Minimum value of Phase (in degrees).
- pdegreeMax – Maximum value of Phase (in degrees).
FDwfAnalogOutPhaseSet(
HDWF hdwf, int idxChannel, double degreePhase)
Description: Sets the phase for the specified channel on the instrument. With channel index -1, each enabled
Analog Out channel phase will be configured to use the same, new option.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- degreePhase – Value of Phase in degrees.
Description: Gets the current phase for the specified channel on the instrument.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pdegreePhase – Pointer to variable to receive Phase value (in degrees).
FDwfAnalogOutDataInfo(
HDWF hdwf, int idxChannel, int *pnSamplesMin, double *pnSamplesMax)
Description: Retrieves the minimum and maximum number of samples allowed for custom data generation.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- pnSamplesMin - Minimum number of samples available for custom data.
- pnSamplesMax – Maximum number of samples available for custom data.
Description: Sets the custom data or to prefill the buffer with play samples. The samples are double precision
floating point values (rgdData) normalized to ±1.
With the custom function option, the data samples (cdData) will be interpolated to the device buffer
size. The output value will be Offset + Sample*Amplitude, for instance:
• 0 value sample will output: Offset.
• +1 value sample will output: Offset + Amplitude.
• -1 value sample will output: Offset – Amplitude.
Parameters:
- hdwf – Open interface handle on a device.
- idxChannel – Channel index.
- rgbData – Buffer of samples to set.
- cData – Number of samples to set in rgbData.