Getting Started with the Digilent Toolbox Add-on for MATLAB®
Description
The Digilent Test & Measurement Toolbox allows users to acquire and analyze data in MATLAB® from Digilent's Analog Discovery, Analog Discovery 2, Analog Discovery Studio, Analog Discovery Pro ADP3250 and ADP3450, Electronic Explorer, and Discovery Power Supply DPS3340.
Featuring analog data streaming, digital I/O control, and configurable power supplies, users can easily collect and send data from Digilent Test and Measurement devices, either directly or with the newly added non-blocking functions with no software limitation on the sampling rate. Users familiar with the old Data Acquisition Toolbox Support Package for Digilent Devices will be pleased to hear that all of their old code can be seamlessly used with the new Toolbox.
Introduction
The following guide presents how to install and use the Digilent Toolbox add-on for MATLAB®, on a Windows operating system. Users developing with the latest versions of MATLAB® and Digilent’s WaveForms now have access to more devices and capabilities.
System Requirements
Hardware
Software
- MATLAB® (compatible with R2021b and newer)
- Digilent Toolbox - this will be installed as part of this guide
Note: The WaveForms set up process is found in the WaveForms Getting Started Guide. By installing the current release of WaveForms, the WaveForms SDK will be installed, which is needed by the Data Acquisition Toolbox to properly work with Digilent devices.
Using an Analog Discovery 2
Connect an Analog Discovery 2 (AD2) device to a Windows system and then launch WaveForms. Verify the AD2 is listed in WaveForms’ Device Manager as ‘Discovery2’. Note that other devices are also supported. The AD2 is used by this guide for demonstration purposes.
Exit WaveForms and launch MATLAB® R2021b or newer.
Once in MATLAB®, select the HOME tab. Click on the Add-Ons menu option and select Manage Add-Ons.
In the Add-On Manager, if the original ‘Data Acquisition Toolbox Support Package for Digilent Analog Discovery Hardware’ item is installed, then it will need to be uninstalled prior to installing the new Digilent Toolbox. Select the ‘Data Acquisition Toolbox Support Package for Digilent Analog Discovery Hardware’ and then click on the vertical ellipsis to the far right. Select ‘Uninstall’.
Next, in the upper right corner, click on ‘Get Add-Ons'.
In the Add-On Explorer’s search field, enter ‘Digilent Toolbox’ and then select the add-on.
Click OK in the popup message window. The message informs the user that the ‘Digilent Toolbox’ was not developed by MathWorks®, but by Digilent and is supported by Digilent.
Once on the ‘Digilent Toolbox’ add-on page, click the ‘Add’ button and select ‘Add to MATLAB’.
A successful installation will show ‘Installed’ on the add-on icon.
The Add-On Manager should show the new Digilent Toolbox. Close the Add-On Manager.
Back in the MATLAB® workspace, the directory field shows the path for the newly installed Digilent Toolbox files.
``(C:\users\{user}\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Digilent Toolbox)``
Next, in the Command Window, enter ‘daqvendorlist’ to view the supported vendors. The new Digilent Toolbox will indicate a driver version of 3.19.5 or newer.
If the original ‘Data Acquisition Toolbox Support Package for Digilent Analog Discovery Hardware’ was not removed, then the ‘digilent’ vendor would appear as ‘Not Operational’, since it would have required an older driver version of WaveForms.
With the list of provided examples shown on the left, double-click on the ‘all_systems.m’ script to open the example in the MATLAB® Editor. This script was written to use an AD2 device, as noted by ‘AD2_0’. An AD2 was wired as instructed by the commented top lines of the script, in order to generate the two ramps shown in Figure 1 of the screen capture.
This script uses two oscilloscope channels, one arbitrary waveform generator (AWG), one programmable power supply channel, and all the digital channels on the AD2 device.
Included with the Digilent Toolbox files is a getting started file, GettingStarted.mlx, with snippets of function calls.
Final Notes
The Digilent Toolbox is also available on the Digilent – MATLAB repository on GitHub.
For more information about how to use WaveForms SDK, please visit the WaveForms SDK Reference Manual.
For technical support, please visit the Test and Measurement section of the Digilent Forums.