Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 2 of 85
WaveFormsSystem
WaveForms Application (GUI)
WaveForms Runtime (Analog Design lib)
Adept Runtime (HW communication)
Digilent Analog Design hardware
Electronics
Explorer
Analog
Discovery
USB 2.0
Custom
Applications
Overview
WaveFormsTM provides an interface that allows users to interact with Digilent Analog Design hardware, such as the
Analog DiscoveryTM 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.
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 the WaveForms Runtime to control all signal generation
and acquisition. 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
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 3 of 85
The static library is located in Windows through the install path:
Windows 32-bit: C:\Program Files\Digilent\WaveFormsSDK\lib\x86
Windows 64-bit: C:\Program Files (x86)\Digilent\WaveFormsSDK\lib\x64
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
The DWF Library uses the 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.
The requirements for the Linux version are the libusb-1.0-0, Digilent Adept Runtime, and the included FTDI drivers:
The Mac OS X application package contains the following components:
WaveFroms Application (GUI):
o Contents\MacOS\*.*
o Contents\Resources\*.*
o Contents\Resources\digilent\waveforms\doc\*
o Contents\PlugIns\*
o Contents\Frameworks\Qt*
WaveFroms Runtime (library)
o Contents\Frameworks\libdwf.dylib
o Contents\Resources\digilent\waveforms\firmware\*
Adept Runtime (library)
o Contents\Frameworks\lib*
o Contents\Resources\digilent\data\*
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 4 of 85
Main Groups of API Functions
Instrument Function
Prefix
Device Enumeration
Controls the enumeration of connected and supported
devices.
DwfEnum
Device Control
Controls opening and closing specific devices.
DwfDevice
AnalogIn (Oscilloscope)
Acquires samples from each enabled channel
synchronously.
DfwAnalogIn
AnalogOut (Arbitrary Waveform
Generator)
Drives signals from each channel independently.
DfwAnalogOut
AnalogIO
Acquires and drives various analog signals.
DfwAnalogIO
DigitalIn (Logic Analyzer)
Acquires samples from digital I/O pins.
DfwDigitalIn
DigitalOut (Pattern Generator)
Drives digital I/O signals.
DfwDigitalOut
DigitalIO
Acquires and drives digital I/O signals.
DfwDigitalIO
System
Obtain basic system information that is instrument
and device independent.
DfwGet
1.1 The API
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:
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 5 of 85
File
Description
Device_Enumeration
List the supported and connected devices. Opens them case are not
opened by other process and gets some information about them.
AnalogIO_AnalogDiscovery_SystemMonitor
Reading the system minitor informations
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 sugnal and perfrom analog in acquisition.
AnalogIn_Sample
Ope the first device, configure analog in and read sample 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_BinrayCounter
Generate binary counter
DigitalIn_Acquisition
Generate signals on digital out and perform acquisition on digital in.
DigitalIn_Record
Perform recording of of large number of digital in samples.
API Functions
Instrument Function
Example
Reset function
This function resets all of the instrument parameters
to default values.
FDwfAnalogInReset
FDwfAnalogOutReset
FDwfDigitalIOReset
Configure function
This function configures and/or starts the instrument.
FDwfAnalogInConfigure
FDwfAnalogOutConfigure
FDwfDigitalIOConfigure
Status function
This function polls and reads all information from the
instrument.
FDwfAnalogInStatus
FDwfAnalogOutStatus
FDwfDigitalIOStatus
Each instrument is directly controlled using three types of functions in the API:
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 a number of 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.
The following examples are provided in python and c++ language.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 6 of 85
Parameters
Parameter Function
*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.
1.2 Calling API Functions
The API functions are C style and return a Boolean value: TRUE if the call is successful, FALSE if unsuccessful. This
Boolean value is an integer type definition, not the standard c-type bool. In general, the API functions contain
variations of the following parameters:
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 the *Get API 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
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 7 of 85
API Error Codes
Error Code Definition
dwfercNoErc
No error occurred.
dwfercUnknownError
Call waiting on pending API time out.
dwfercApiLockTimeout
Call waiting on pending API time out.
dwfercAlreadyOpened
Device already opened.
dwfercNotSupported
Device not supported.
dwfercInvalidParameter0
Parameter 0 was invalid in last API call.
dwfercInvalidParameter1
Parameter 1 was invalid in last API call.
dwfercInvalidParameter2
Parameter 2 was invalid in last API call.
dwfercInvalidParameter3
Parameter 3 was invalid in last API call.
2 System
FDwfGetLastError(DWFERC *pdwferc)
Parameters:
- pdwferc - Variable to receive error code.
The function above is used to retrieve 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:
FDwfGetLastErrorMsg(char szError[512])
Parameters:
- szError - Pointer to buffer to receive error string.
The function above is used to retrieve 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.
FDwfGetVersion(char szVersion[32])
Parameters:
- szVersion - Pointer to buffer to receive version string.
The function above is used to retrieve the version string. The version string is composed of major, minor, and build
numbers (i.e., “2.0.19”).
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 8 of 85
3 Device Enumeration
The FDwfEnum functions are used to discover all connected, compatible devices.
See Device_Enumeration.py example.
FDwfEnum(ENUMFILTER enumfilter, int *pnDevice)
Parameters:
- enumfilter – Filter value to be used for device enumeration. Use the enumfilterAll constant to discover all
compatible devices.
- pnDevice – Integer pointer to return count of found devices by reference.
Calling the function above will build an internal list of detected devices filtered by the enumfilter parameter. The
function above must be called before using other FDwfEnum functions because they obtain information about
enumerated devices from this list identified by the device index.
- szDeviceName – Pointer to character array to return the device name by reference.
The function above is used to retrieve the device name of the enumerated device.
FDwfEnumSN(int idxDevice, char szSN[32])
Parameters:
- idxDevice – Index of the enumerated device.
- szSN – Pointer to character array to return the serial number by reference.
The function above is used to retrieve the 12-digit, unique serial number of the enumerated device.
FDwfEnumConfig(int idxDevice, int *pcConfig)
Parameters:
- idxDevice – Index of the enumerated device.
- pcConfig – Integer pointer to return count of found configurations by reference.
Calling the function above will build 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.
FDwfEnumConfigInfo(int idxConfig, DwfEnumConfigInfo info, int *pValue)
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.
The function above is used to return information about the configuration. The information types,
DwfEnumConfigInfo, are declared in dwf.h:
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 10 of 85
4 Device Control
FDwfDeviceOpen(int idxDevice, HDWF *phdwf)
Parameters:
- idxDevice – Zero based index of the enumerated device.
- phdwf – Pointer to HDWF variable to receive opened interface handle by reference.
The function above 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.
FDwfDeviceConfigOpen(int idxDevice, int idxCfg, HDWF *phdwf)
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.
The function above opens a device identified by the enumeration index with the selected configuration and
retrieves a handle.
FDwfDeviceClose(HDWF hdwf)
Parameters:
- hdwf – Interface handle to be closed.
The function above is used to close 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.
FDwfDeviceCloseAll()
Parameters: None.
The function above is used to close all opened devices by the calling process. It does not close all devices across all
processes.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
- fAutoConfigure– Value for this option: TRUE if enabled, FALSE if disabled.
The function above 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.
- pfAutoConfigure– Pointer to variable to receive the current value of this option.
The function above returns the AutoConfig setting in the device. See the function description for
FDwfDeviceAutoConfigureSet for details on this setting.
DwfDeviceReset(HDWF hdwf)
Parameters:
- hdwf – Interface handle.
The function above resets and configures (by default, having auto configure enabled) all device and instrument
parameters to default values.
FDwfDeviceTriggerInfo(HDWF hdwf, int *pfstrigsrc)
Parameters:
- hdwf – Interface handle.
- pfstrigsrc – Variable to receive the supported trigger sources.
The function above 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.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 12 of 85
Trigger Source Options
Trigger Source Function
trigsrcNone
The trigger pin is high impedance, input. This is the default
setting.
trigsrcPC
Trigger from PC, this can be used to synchronously start
multiple instruments.
trigsrcDetectorAnalogIn
Trigger detector on analog in channels.
trigsrcDetectorDigitalIn
Trigger on digital input channels.
trigsrcAnalogIn
Trigger on device instruments, these output high when running.
trigsrcDigitalIn
Trigger on device instruments, these output high when running.
trigsrcDigitalOut
Trigger on device instruments, these output high when running.
trigsrcAnalogOut1
Trigger on device instruments, these output high when running.
trigsrcAnalogOut2
Trigger on device instruments, these output high when running.
trigsrcAnalogOut3
Trigger on device instruments, these output high when running.
trigsrcAnalogOut4
Trigger on device instruments, these output high when running.
trigsrcExternal1
External trigger signal.
trigsrcExternal2
External trigger signal.
trigsrcExternal3
External trigger signal.
trigsrcExternal4
External trigger signal.
The global trigger bus allows multiple instruments to trigger each other. These trigger source options are:
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 13 of 85
Trig Ext
DI/O
ADC
Oscilloscope
Trigger Detector
Control
Analyzer
Trigger Detector
Control
Patterns
Control
Trigger signals bus
Board ON
WaveGen 1
Control
FDwfDeviceTriggerSet(HDWF hdwf, int idxPin, TRIGSRC trigsrc)
Parameters:
- hdwf – Interface handle.
- idxPin – External trigger, I/O pin index.
- trigsrc – Trigger source to set.
The function above is used to configure the trigger I/O pin with a specific TRIGSRC option.
FDwfDeviceTriggerGet(HDWF hdwf, int idxPin, TRIGSRC *ptrigsrc)
Parameters:
- hdwf – Interface handle.
- idxPin - External trigger, I/O pin index.
- ptrigsrc – Variable to receive the current trigger source.
The function above returns the configured trigger setting for a trigger I/O pin. The trigger source can be “none”, an
internal instrument, or an external trigger.
FDwfDeviceTriggerPC(HDWF hdwf)
Parameters:
- hdwf – Interface handle.
The function above generates one pulse on the PC trigger line.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 14 of 85
Start?
Reconfigure?
Trigger?
Start?
Ready
Armed
Running
Done
Instrument configuration or setting
Prefill
Configure
5 Analog In (Oscilloscope)
The Analog In instrument states:
The states are defined in dwf.h DwfState type.
- 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:
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 record length parameter.
- Done: Final state.
See the following examples: AnalogIn_Sample/Acquisition/Trigger/Record.py AnalogOutIn.py
5.1 Control
FDwfAnalogInReset(HDWF hdwf)
Parameters:
- hdwf – Interface handle.
The function above resets and configures (by default, having auto configure enabled) all AnalogIn instrument
parameters to default values.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
- psts – Variable to receive the acquisition state.
The function above is used to check 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.
Note: To ensure simultaneity of information and data, all of the following AnalogInStatus** *functions do not
communicate with the device. These functions only return information and data from the last
FDwfAnalogInStatus call.
FDwfAnalogInStatusSamplesLeft(HDWF hdwf, int *pcSamplesLeft)
Parameters:
- hdwf – Interface handle.
- pcSamplesLeft – Variable to receive the remaining samples to acquire.
The function above is used to retrieve the number of samples left in the acquisition.
FDwfAnalogInStatusSamplesValid(HDWF hdwf, int *pcSamplesValid)
Parameters:
- hdwf – Interface handle.
- pcSamplesValid – Variable to receive the number of valid samples.
The function above is used to retrieve the number of valid/acquired data samples.
FDwfAnalogInStatusIndexWrite(HDWF hdwf, int *pidxWrite)
Parameters:
- hdwf – Interface handle.
- pidxWrite – Variable to receive the position of the acquisition.
The function above is used to retrieve the buffer write pointer. This is needed in ScanScreen acquisition mode to
display the scan bar.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
- pfAuto – Returns TRUE if the acquisition was auto triggered.
The function above is used to verify if the acquisition is auto triggered.
FDwfAnalogInStatusData(
HDWF hdwf, int idxChannel, double *rgdVoltData, int cdData)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- rgdVoltData – Pointer to allocated buffer to copy the acquisition data.
- cdData – Number of samples to copy.
The function above is used to retrieve the acquired data samples from the specified idxChannel on the AnalogIn
instrument. It copies the data samples to the provided buffer.
FDwfAnalogInStatusNoise(
HDWF hdwf, int idxChannel, double *rgdMin, double *rgdMax, int cdData)
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.
The function above is used to retrieve the acquired noise samples from the specified idxChannel on the AnalogIn
instrument. It copies the data samples to the provided buffer.
FDwfAnalogInStatusSample(HDWF hdwf, int idxChannel, double *pdVoltSample)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pdVoltSample – Variable to receive the sample value.
The function above gets the last ADC conversion sample from the specified idxChannel on the AnalogIn
instrument.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 17 of 85
FDwfAnalogInStatusRecord(
HDWF hdwf, int *pcdDataAvailable, int *pcdDataLost, int *pcdDataCorrupt)
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.
The function above is used to retrieve 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).
- phzFrequency – Variable to receive the acquisition frequency.
The function above is used to read 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.
FDwfAnalogInBitsInfo(HDWF hdwf, int *pnBits)
Parameters:
- hdwf – Interface handle.
- pnBits – Variable to receive the number of ADC bits.
The function above is used to retrieve the number bits used by the AnalogIn ADC.
FDwfAnalogInBufferSizeInfo(HDWF hdwf, int *pnSizeMin, int *pnSizeMax)
Parameters:
- hdwf – Interface handle.
- pnMin – Pointer to return the minimum buffer size.
- pnMax – Pointer to return the maximum buffer size.
The function above returns the minimum and maximum allowable buffer sizes for the instrument.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 19 of 85
FDwfAnalogInBufferSizeSet(HDWF hdwf, int nSize)
Parameters:
- hdwf – Interface handle.
- nSize – Buffer size to set.
The function above is used to adjust the AnalogIn instrument buffer size.
FDwfAnalogInBufferSizeGet(HDWF hdwf, int *pnSize)
Parameters:
- hdwf – Interface handle.
- pnSize – Variable to receive the current buffer size.
The function above returns the used AnalogIn instrument buffer size.
FDwfAnalogInNoiseSizeInfo(HDWF hdwf, int *pnSizeMax)
Parameters:
- hdwf – Interface handle.
- pnMax – Pointer to return the maximum noise buffer size.
The function above returns the maximum buffer size for the instrument.
FDwfAnalogInNoiseSizeGet(HDWF hdwf, int *pnSize)
Parameters:
- hdwf – Interface handle.
- pnSize – Variable to receive the current noise buffer size.
The function above returns the used AnalogIn instrument noise buffer size. This is automatically adjusted
according 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.
FDwfAnalogInAcquisitionModeInfo(HDWF hdwf, int *pfsacqmode)
Parameters:
- hdwf – Interface handle.
- pfsacqmode – Pointer to return the supported acquisition modes.
The function above 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:
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 20 of 85
ACQMODE Constants
FUNC Constant Capabilities
acqmodeSingle
Perform a single buffer acquisition. This is the default setting.
acqmodeScanShift
Perform a continuous acquisition in FIFO style. The trigger setting is ignored.
The last sample is at the end of buffer. The
FDwfAnalogInStatusSamplesValid 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
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
Perform acquisition for length of time set by
FDwfAnalogInRecordLengthSet.
- pacqmode – Variable to receive the current acquisition mode.
The function above is used to get retrieve the acquisition mode.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 21 of 85
5.3 Channels
The oscilloscope channel settings are identical across all channels.
FDwfAnalogInChannelCount(HDWF hdwf, int *pcChannel)
Parameters:
- hdwf – Interface handle.
- pcChannel – Variable to receive the number of channels.
The function above is used to read the number of AnalogIn channels of the device.
FDwfAnalogInChannelEnableSet(HDWF hdwf, int idxChannel, BOOL fEnable)
Parameters:
- hdwf – Interface handle.
- idxChannel – Zero based index of channel to enable/disable.
- fEnable – Set TRUE to enable, FALSE to disable.
The function above is used to enable or disable the specified AnalogIn channel.
FDwfAnalogInChannelEnableGet(HDWF hdwf, int idxChannel, BOOL *pfEnable)
Parameters:
- hdwf – Interface handle.
- idxChannel – Index of channel.
- pfEnable – Variable to return enable/disable status of channel.
The function above is used to get the current enable/disable status of the specified AnalogIn channel.
FDwfAnalogInChannelFilterInfo(HDWF hdwf, int *pfsfilter)
Parameters:
- hdwf – Interface handle.
- pfsfilter – Pointer to return the supported acquisition modes.
The function above returns the supported acquisition filters. 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), the samples can be stored in one of the following ways using FILTER:
filterDecimate: Store every Nth ADC conversion, where N = ADC frequency /acquisition frequency.
filterAverage: Store the average of N ADC conversions.
filterMinMax: Store interleaved, the minimum and maximum values, of 2xN conversions.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 22 of 85
FDwfAnalogInChannelFilterSet(HDWF hdwf, int idxChannel, FILTER filter)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- filter – Acquisition sample filter to set.
The function above is used to set 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.
FDwfAnalogInChannelFilterGet(HDWF hdwf, int idxChannel, FILTER *pfilter)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pfilter– Variable to receive the current sample filter.
The function above returns the configured acquisition filter.
- pvoltsMin – Variable to receive the minimum voltage range.
- pvoltsMax – Variable to receive the maximum voltage range.
- pnSteps – Variable to receive number of steps.
The function above returns the minimum and maximum range, peak to peak values, and the number of adjustable
steps.
FDwfAnalogInChannelRangeSteps(
HDWF hdwf, double rgVoltsStep[32], int *pnSteps)
Parameters:
- hdwf – Interface handle.
- rgVoltsStep – Pointer to buffer to receive the range steps.
- pnSteps – Variable to receive number range steps.
The function above is used to read the range of steps supported by the device. For instance: 1, 2, 5, 10, etc.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 23 of 85
FDwfAnalogInChannelRangeSet(HDWF hdwf, int idxChannel, double voltsRange)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- voltsRange – Voltage range to set.
The function above is used to configure the range for each channel. With channel index -1, each enabled Analog In
channel range will be configured to the same, new value.
FDwfAnalogInChannelRangeGet(HDWF hdwf, int idxChannel, double *pvoltsRange)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pvoltsRange – Variable to receive the current voltage range.
The function above returns the real range value for the given channel.
- pvoltsMin – Variable to receive the minimum offset voltage.
- pvoltsMax – Variable to receive the maximum offset voltage.
- pnSteps – Variable to receive the number offset steps.
The function above returns the minimum and maximum offset levels supported, and the number of adjustable
steps.
FDwfAnalogInChannelOffsetSet(HDWF hdwf, int idxChannel, double voltOffset)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- voltsRange – Channel offset voltage to set.
The function above is used to configure the offset for each channel. When channel index is specified as -1, each
enabled AnalogIn channel offset will be configured to the same level.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 24 of 85
FDwfAnalogInChannelOffsetGet(HDWF hdwf, int idxChannel, double *pvoltOffset)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pvoltsRange – Variable to receive the offset voltage obtained.
The function above returns for each AnalogIn channel the real offset level.
FDwfAnalogInChannelAttenuationSet(
HDWF hdwf, int idxChannel, double xAttenuation)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- voltsRange – Channel offset voltage to set.
The function above is used to configure 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.
FDwfAnalogInChannelAttenuationGet(
HDWF hdwf, int idxChannel, double *pxAttenuation)
Parameters:
- hdwf – Interface handle.
- idxChannel – Channel index.
- pxAttenuation – Variable to receive the attenuation value.
The function above returns for each AnalogIn channel the configured attenuation.
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.
WaveForms™ SDK Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 25 of 85
FDwfAnalogInTriggerSourceInfo(HDWF hdwf, int *pfstrigsrc)
Parameters:
- hdwf – Interface handle.
- pfstrigsrc – Variable to receive the supported trigger sources.
The function above returns the supported trigger source 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 TRIGSRC constants in dwf.h. For more detail regarding these constants, see the description of
- psecMin – Variable to receive the minimum trigger position.
- psecMax – Variable to receive the maximum trigger position.
The function above returns the minimum and maximum values of the trigger position in seconds. The horizontal
trigger position is used for Single acquisition mode and it is relative to the buffer middle point.
- psecPosition – Variable to receive the current trigger position.
The function above returns the configured trigger position in seconds.
FDwfAnalogInTriggerAutoTimeoutInfo(
HDWF hdwf, double *psecMin, double *psecMax, int *pnSteps)
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.
The function above 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.