Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
test-and-measurement:guides:getting-started-with-labview [2022/09/12 15:47] – changed forum.digilentinc.com to forum.digilent.com Jeffrey | test-and-measurement:guides:getting-started-with-labview [2024/04/18 18:28] (current) – Add ULx callout Arthur Brown | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Getting Started with LabVIEW and a Digilent Discovery Device ====== | ||
+ | ~~TechArticle~~ | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The following guide presents how to install and use the Digilent WaveForms VIs LabVIEW package, to control Digilent Test and Measurement devices. Demos for controlling the Power Supply, the Digital I/O lines, the Waveform Generator, and the Oscilloscope instruments can be found in the [[getting-started-with-labview# | ||
+ | ---- | ||
+ | |||
+ | ===== Inventory ===== | ||
+ | |||
+ | <WRAP group> | ||
+ | * A Digilent Test and Measurement device | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * [[test-and-measurement: | ||
+ | * A Computer with the latest version of WaveForms and LabVIEW installed | ||
+ | </ | ||
+ | |||
+ | **Note:** //If a Test and Measurement device without analog input and/or output channels (Digital Discovery), or without variable power supplies (Analog Discovery) is selected, certain examples in this guide will not work.// | ||
+ | |||
+ | **Note:** //The latest installers for WaveForms can be downloaded Digilent' | ||
+ | |||
+ | **Note:** //To download LabVIEW, an NI account is needed. Alternatively, | ||
+ | |||
+ | If you're looking for LabVIEW support for // | ||
+ | ---- | ||
+ | |||
+ | ===== Setup and Use Instructions ===== | ||
+ | |||
+ | ==== Hardware Setup ==== | ||
+ | |||
+ | <WRAP group> | ||
+ | Plug in the Test and Measurement device to the computer via an USB cable. | ||
+ | |||
+ | If your device requires external power, plug in its power supply to an outlet, then plug the power supply' | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | ==== Software Setup ==== | ||
+ | |||
+ | <WRAP group>< | ||
+ | Launch LabVIEW and click on the **Tools** menu. Select **VI Package Manager** from the list to open the VI Package Manager (VIPM). | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | --> What to do if the VI Package Manager is not installed? # | ||
+ | <WRAP group>< | ||
+ | If the **VI Package Manager** option is not listed under the **Tools** menu, select the **Find LabVIEW Add-ons** option. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | The **NI Tools Network** web page will open. Enter **VI Package Manager** in the search field. Select the **JKI VI Package Manager Download** from the search results. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | Click on **DOWNLOAD** and proceed to install the VI Package Manager (VIPM) application onto the target Windows system. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <-- | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | Select the LabVIEW version installed on the target system (1). Enter **Digilent** in the search field (2) to display related packages. Select the **Digilent WaveForms VIs** package (3) and then click the **Install** button (4). | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | Click on an **agree** option in order to proceed. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | Click the **I Accept** button to continue. | ||
+ | </ | ||
+ | {{ : | ||
+ | |||
+ | </ | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | At this point, a message window may appear prompting to restart LabVIEW, if it is open. Click **OK** on the message window. If the restart message does not appear and the system does not automatically restart LabVIEW, then the user should restart the LabVIEW application. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | --> What to do if you get a Batch Process Error? # | ||
+ | <WRAP group>< | ||
+ | If prompted with a **VIPM - Batch Process Error**, click the **OK** button. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | Next, click the **Finish** button and restart LabVIEW. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | Once back into LabVIEW, click on **Tools** from the top menu and then select **Options**. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | In the **Options** window, select **VI Server** and then scroll down on the right side until you reach **Machine Access**. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | **Note: | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <-- | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | Next, when prompted with **VIPM - Package License Agreements**, | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | Click the **Finish** button once the package has been installed and then restart LabVIEW. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | To access the Digilent WaveForms VIs Reference, launch LabVIEW, click on **Help**, and then select **Digilent WaveForms VIs Reference**. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | To access the Digilent WaveForms VI functions via the Block Diagram, click on **View** from the top menu and then select **Functions Palette**. Alternatively, | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <WRAP group>< | ||
+ | The Digilent WaveForms VI examples are located in the target system' | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <WRAP group> | ||
+ | From here, a user can open examples demonstrating the functionality of different instruments, | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | ==== Examples ==== | ||
+ | |||
+ | --> Power Supply Example # | ||
+ | <WRAP group> | ||
+ | Download and unzip the provided example file {{ reference: | ||
+ | |||
+ | To use the //Power Supply// instrument within LabVIEW, the following subvis are available in the Measurement I/O → Digilent WF VIs → Power Supply container: | ||
+ | <WRAP column half> | ||
+ | * Initialize: allows the user to select the Digilent Test and Measurement device and sends the device handler to the other power supply subvis. | ||
+ | * Voltage: is used to set the voltage level and the current limit for channels V+, V- or VIO. | ||
+ | * Enable: enables/ | ||
+ | * Close: Closes the instrument when the program is terminated, making it available for other software (no instrument can be controlled by two programs at the same time). | ||
+ | * Other subvis for reading the voltage, reading the current limit, checking whether the supplies are enabled or not, resetting | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | A LabVIEW Virtual Instrument consists of two parts: the Front Panel and the Block Diagram. The Front Panel contains all controls and indicators for data in- and output and serves as a user interface when the program is running. The Block Diagram contains the blocks which are present on the Front Panel, but also other block which are necessary for information processing and the connections between these blocks. One can add a new block to both windows by right clicking on a blank space in the corresponding window and selecting the required block from a library. Blocks already present in the window can be modified by right clicking on the respective block. In the following paragraphs, this example' | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | The Front Panel contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | |||
+ | In this example the panel is separated in two parts with decorative elements. In the upper part there is a drop-down list with the name Device which is used to select the Test and Measurement device used. The Stop button (2) is also found here. With this button the program can be stopped, and the power supplies turned off. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | The lower part contains the Master Enable switch and a virtual LED which signals the state of this switch, and two separated parts for the positive and negative power supply. Both parts contain an ON/OFF switch with a virtual LED which signals the power supply state and a slider, which sets the voltage level of the power supply. If the Digital Discovery is chosen in the upper part and the program is started with the **Run** button, the objects controlling the negative power supply will be disabled and grayed out. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | The Block Diagram contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | |||
+ | <WRAP column half> | ||
+ | In this example the Block Diagram is separated in three parts with the help of decorative and functional structures. The first part named Device selection and initialization contains the combo box Device (control element), compares its output to predefined strings and initializes the //Power Supplies// instrument with the selected device name. This part has zero incoming and three outgoing signals: the //Power Supplies// instrument device handler, the errors and a flag which is true if the Digital Discovery, the ADP3450, or the ADP3250 was selected and false otherwise. | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | |||
+ | <WRAP group>< | ||
+ | The next section is in a while loop, so it is repeated until a certain condition is met, with 100ms wait time between iterations. This part has as incoming signals the three from the previous section. The error signal and the device handler are cascaded to the //Power Supply// instrument settings, which also receive data from other control elements: voltage level sliders (V+ voltage and V- voltage) and power supply state switches (V+ and V-). These settings blocks are followed by property nodes, which are able to modify different parameters of existing blocks, in this case according to the device type, the V- channel is enabled/ | ||
+ | </ | ||
+ | {{ : | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | If the loop is exited, the device handler and the errors are passed to the next section, which turns off the supplies, closes the instrument and sets all switches and virtual LEDs to off state, then displays an error message if there was one. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | To run the VI, first on the front panel select the Test and Measurement device used, then press the **Run** button. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | From here the power supply channels can be enabled with the help of the switches and adjusted with the help of the sliders. To visualize the output voltage, an LED should be connected in series with a 220Ω | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <-- | ||
+ | |||
+ | --> Digital I/O Example 1 - Virtual I/O # | ||
+ | <WRAP group> | ||
+ | Download and unzip the provided example file {{ reference: | ||
+ | |||
+ | To access the digital I/O pins of the Test and Measurement device within LabVIEW, the following subvis are available in the Measurement I/O → Digilent WF VIs → Dig container: | ||
+ | <WRAP column half> | ||
+ | * Initialize : allows the user to select the Digilent Test and Measurement device and sends the device handler to the other digital I/O subvis. | ||
+ | * Read: is used to read the state of a given set of digital I/O lines. | ||
+ | * Write: is used to set the state of a given set of digital I/O lines. | ||
+ | * Close: Closes the instrument when the program is terminated, making it available for other software (no instrument can be controlled by two programs at the same time). | ||
+ | * Other subvis for adding tristate buffers to the I/O lines, resetting the instrument or getting information about the state of the lines (tristated/ | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | A LabVIEW Virtual Instrument consists of two parts: the Front Panel and the Block Diagram. The Front Panel contains all controls and indicators for data in- and output and serves as a user interface when the program is running. The Block Diagram contains the blocks which are present on the Front Panel, but also other block which are necessary for information processing and the connections between these blocks. One can add a new block to both windows by right clicking on a blank space in the corresponding window and selecting the required block from a library. Blocks already present in the window can be modified by right clicking on the respective block. In the following paragraphs, this example' | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | The Front Panel contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | |||
+ | In this example the panel is separated in two parts with decorative elements. In the upper part there is a drop-down list with the name Device which is used to select the Test and Measurement device used. The **Stop** button (2) is also found here. With this button the program can be stopped, and the digital I/O lines all set to LOW. | ||
+ | |||
+ | The lower part contains a slider ranging from 0 to 16 (control) and 16 virtual LEDs, each one named after a digital I/O line. When the program is running, the slider determines how many of the digital lines will be HIGH. By moving the slider, the number of lines set to HIGH can be modified. The virtual LEDs indicate if a line is HIGH (they are lit if HIGH and dark if LOW). | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | The Block Diagram contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | |||
+ | <WRAP column half> | ||
+ | In this example the Block Diagram is separated in three parts with the help of decorative and functional structures. The first part named Device selection and initialization contains the combo box Device (control element) and initializes the //Digital IO// instrument with the selected device name. This part has zero incoming and two outgoing signals: the //Digital IO// instrument device handler and the error signal. | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | |||
+ | <WRAP group>< | ||
+ | The next section is in a while loop, so it is repeated until a certain condition is met, with 100ms wait time between iterations. This part has as incoming signals the two from the previous section. The error signal and the device handler are connected to the DIO-Write block, which also receives data from the input slider. The number outputted by the slider is converted to a Boolean array with 8 elements, then the content of this array is written to the digital I/O lines. The error and instrument handle signals are connected then to the DIO-Read block. With the help of this block, the program reads the values of digital I/O lines 0 to 15, then converts the Boolean array to a number. This number is compared to constant values and the result of each comparison decides the state of the virtual LEDs. The loop is exited if there is an error, or the **Stop** button is pressed on the Front Panel. The instrument handle and the errors are sent towards the next part. | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | If the loop is exited, the state of all virtual LEDs is set to false (LEDs are turned off) with the help of property nodes, then an all 0 boolean array is written to the digital I/O lines (all lines are set to LOW). The instrument is closed making it available to other programs, then an error message is displayed, if there were any errors. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | To run the VI, first on the front panel select the Test and Measurement device used, then press the **Run** button. | ||
+ | |||
+ | From here the state of digital I/O lines 0 to 15 can be set by the slider. The state of the pins is also read back and displayed with the help of the virtual LEDs . The program can be terminated with the **Stop** button on the Front Panel. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <-- | ||
+ | |||
+ | --> Digital I/O Example 2 - Simple Loopback# | ||
+ | <WRAP group> | ||
+ | Download and unzip the provided example file {{ reference: | ||
+ | |||
+ | To access the digital I/O pins of the Test and Measurement device within LabVIEW, the following subvis are available in the Measurement I/O → Digilent WF VIs → Dig container: | ||
+ | <WRAP column half> | ||
+ | * Initialize : allows the user to select the Digilent Test and Measurement device and sends the device handler to the other digital I/O subvis. | ||
+ | * Read: is used to read the state of a given set of digital I/O lines. | ||
+ | * Write: is used to set the state of a given set of digital I/O lines. | ||
+ | * Close: Closes the instrument when the program is terminated, making it available for other software (no instrument can be controlled by two programs at the same time). | ||
+ | * Other subvis for adding tristate buffers to the I/O lines, resetting the instrument or getting information about the state of the lines (tristated/ | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | A LabVIEW Virtual Instrument consists of two parts: the Front Panel and the Block Diagram. The Front Panel contains all controls and indicators for data in- and output and serves as a user interface when the program is running. The Block Diagram contains the blocks which are present on the Front Panel, but also other block which are necessary for information processing and the connections between these blocks. One can add a new block to both windows by right clicking on a blank space in the corresponding window and selecting the required block from a library. Blocks already present in the window can be modified by right clicking on the respective block. In the following paragraphs, this example' | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | The Front Panel contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | |||
+ | In this example the panel is separated in two parts with decorative elements. In the upper part there is a drop-down list with the name Device which is used to select the Test and Measurement device used. The **Stop** button (2) is also found here. With this button the program can be stopped, and the digital I/O lines all set to LOW. | ||
+ | |||
+ | The lower part contains a slider ranging from 0 to 9 (control), two text fields (indicator), | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | The Block Diagram contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | |||
+ | <WRAP column half> | ||
+ | In this example the Block Diagram is separated in three parts with the help of decorative and functional structures. The first part named Device selection and initialization contains the combo box list Device (control element) and initializes the //Digital IO// instrument with the selected device name. This part has zero incoming and two outgoing signals: the //Digital IO// instrument device handler and the error signal. | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | |||
+ | <WRAP group>< | ||
+ | The next section is in a while loop, so it is repeated until a certain condition is met, with 100ms wait time between iterations. This part has as incoming signals the two from the previous section. According to the number set on the slider, the two strings are determined, which will be displayed on the front panel. The binary string is then converted to a binary array and this array is sent to the digital I/O lines 0-6, as well as to the seven virtual LEDs showing the state of these lines. | ||
+ | |||
+ | As a next step, the state of the digital I/O lines 8-14 is read and the segments of the seven-segment display are controlled according to the received values. The loop is exited if there is an error, or the **Stop** button is pressed on the Front Panel. The instrument handle and the errors are sent towards the next part. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | When the loop is exited, the state of all virtual LEDs is set to false (LEDs are turned off) with the help of property nodes, the strings are replaced with an empty string, then an all 0 Boolean array is written to the digital I/O lines (all lines are set to LOW). The instrument is closed making it available to other programs, then an error message is displayed, if there were any errors. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | To run the VI, first on the front panel select the Test and Measurement device used, then press the **Run** button. | ||
+ | |||
+ | Connect DIO pins 0-6 to DIO pins 8-14, as seen in the diagram to the right. DIO lines 0-6 are used as output and are controlled by the slider. As the segments of the seven-segment display are connected to digital I/O lines 8-14, connecting the respective pins will display the number set on the slider. The program can be terminated with the **Stop** button on the Front Panel | ||
+ | </ | ||
+ | {{ : | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | <-- | ||
+ | |||
+ | --> Analog I/O Example # | ||
+ | <WRAP group> | ||
+ | Download and unzip the provided example file {{ reference: | ||
+ | |||
+ | To use the //Waveform Generator// instrument within LabVIEW, the following subvis are available in the Measurement I/O → Digilent WF VIs → FGEN container: | ||
+ | <WRAP column half> | ||
+ | * Initialize: allows the user to select the Digilent Test and Measurement device and sends the device handler to the other wavegen subvis. | ||
+ | * Standard: is used to set the function to be generated as well as the function’s amplitude, DC offset, duty cycle and frequency. | ||
+ | * Run: is used to start the function generator. | ||
+ | * Stop: stops the function generator. | ||
+ | * Close: Closes the instrument when the program is terminated, making it available for other software (no instrument can be controlled by two programs at the same time). | ||
+ | * Other subvis for generating arbitrary waveforms, returning data about the state of the function generator, resetting the instrument, etc. are also available (these are not used in the example program). | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group> | ||
+ | To use the // | ||
+ | <WRAP column half> | ||
+ | * Initialize: allows the user to select the Digilent Test and Measurement device and sends the device handler to the other scope subvis. | ||
+ | * Read: is used to aquire data from the sellected scope channel. | ||
+ | * Run: is used to start the oscilloscope. | ||
+ | * Stop: stops the oscilloscope. | ||
+ | * Close: closes | ||
+ | * Analog: allows the user to select a channel and set the coupling type and the probe attenuation (which can be useful when using BNC probes). | ||
+ | * Analog Edge: is used to set the trigger level, the trigger slope and the trigger hysteresis for the selected channel. | ||
+ | * Timing: is used to configure the basic timing settings (like acquisition time and sample rate) of the instrument | ||
+ | * Other subvis for setting channel and trigger properties, returning data about the state of the oscilloscope, | ||
+ | </ | ||
+ | {{ : | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | A LabVIEW Virtual Instrument consists of two parts: the Front Panel and the Block Diagram. The Front Panel contains all controls and indicators for data in- and output and serves as a user interface when the program is running. The Block Diagram contains the blocks which are present on the Front Panel, but also other block which are necessary for information processing and the connections between these blocks. One can add a new block to both windows by right clicking on a blank space in the corresponding window and selecting the required block from a library. Blocks already present in the window can be modified by right clicking on the respective block. In the following paragraphs, this example' | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | The Front Panel contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | |||
+ | In this example the panel is separated in three parts with decorative elements. In the upper left part, there is a drop-down list with the name Device which is used to select the Test and Measurement device used. The **Stop** button (2) is also found here. With this button the program and both the // | ||
+ | |||
+ | The lower left part contains all the control elements for the //Wavegen// instrument: channel and function selector drop-down lists, sliders and text boxes for setting the amplitude and DC offset voltages and text boxes for setting the duty cycle, the starting and ending frequency and the frequency increment of the sweep. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | The right part named Oscilloscope contains four drop-down lists for scope channel selection, setting coupling type, setting trigger edge, and setting probe attenuation (by default this is set to 1X, should be modified if BNC probes are used) and a numeric control to set the speed of the measurements (it sets the acquisition time for every step). Beside of the control fields, a plot pane is also present: here will be displayed the measured signal. The range of the axis is set automatically. | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group> | ||
+ | The Block Diagram contains, along with the menu bar, the alignment setting, search buttons, etc. (see more at: [[https:// | ||
+ | </ | ||
+ | |||
+ | <WRAP group>< | ||
+ | In this example the Block Diagram is separated in three parts with the help of decorative and functional structures. The first part is responsible for setting up the instruments according to the parameters retrieved from the Front Panel control elements. The setup processes of the //Wavegen// and the //Scope// instruments are done in parallel. | ||
+ | |||
+ | In the upper part, the selected channel of the //Wavegen// instrument is initialized, | ||
+ | |||
+ | In the lower part, the //Scope// instrument is initialized, | ||
+ | |||
+ | The acquisition time of the instrument is set accordingly to the Speed control element, the pretrigger time is set to 0 and the sampling frequency is set to 100 times the maximum signal frequency. The sampling frequency must be much higher then the maximum frequency of the sampled signal, because, if the signal is a rectangular or a triangular one, it contains high frequency harmonics as well at frequencies which are odd multiples of the fundamental frequency. To measure some of these components, according to the Nyquist criterion, $f_s$ (the sampling frequency) must be at least two times larger, than $f_m$ (the frequency of the measured component). With setting $f_s$ to $100f_{max}$ we can measure the first 25 harmonics of the signal, which gives a nearly perfect approximation. | ||
+ | |||
+ | The axis ranges of the plot pane are also set here: the X axis is ranging from 0 to the starting period and the Y axis is set to display the full peak-to-peak range of the signal. | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | The next part is in a while loop, so it is repeated until a certain condition is met, with 10ms wait time between iterations. This part has as incoming signals the instrument handles and error signals from the previous section, as well as the //Wavegen// instrument parameters (Duty Cycle, Starting Frequency, Waveform Function, Amplitude and DC offset) as local variables. The loop contains a **Standard** block (Wavegen settings), which receives as parameters the same ones as the **Standard** block in the previous section, but the Frequency is changed with every iteration, the new frequency being calculated as the sum of the starting frequency and the product between the frequency increment and the iteration index. If this calculated frequency becomes greater or equal to the ending frequency, the loop is exited. Other conditions which cause the program to exit the loop are errors appearing or if the **Stop** button is pressed on the Front Panel. | ||
+ | |||
+ | The loop also contains the **Run** block, which starts the Scope and takes a measurement, | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | If the loop is exited, both instruments are stopped and closed, to make them available for other software. The two error signals are merged and handled: an error message is displayed, if there were any errors during execution. | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | <WRAP group>< | ||
+ | To run the VI, first, on the Front Panel select the Test and Measurement device used, set the attributes of the desired waveform and the parameters of the frequency sweep, then press the **Run** button. The measurement can be stopped at any time with the **Stop** button, or is finished when the ending frequency is reached. | ||
+ | </ | ||
+ | {{ reference: | ||
+ | </ | ||
+ | <WRAP group>< | ||
+ | To to test the example , connect the Test and Measurement device' | ||
+ | </ | ||
+ | {{ : | ||
+ | </ | ||
+ | |||
+ | //If your Digilent Test and Measurement device supports BNC cables, more options are available. Select your device, below, for instructions on using these cables.// | ||
+ | |||
+ | --> Analog Discovery 3 with BNC Adapter # | ||
+ | <WRAP group> <WRAP column half> | ||
+ | Connect the [[test-and-measurement: | ||
+ | |||
+ | **Note:** //For this demo, both ground wires were not connected together, because the Oscilloscope channel shares the same ground as the Wavegen channel. While BNC Probes are single-ended (as is the Waveform Generator hardware), a connected circuit must still share a common ground with the device. No more than one ground should be connected, in order to avoid the creation of ground loops, which may damage your device.// | ||
+ | |||
+ | **Note:** //When using BNC Probes, make sure to take note of the probes' | ||
+ | </ | ||
+ | {{: | ||
+ | </ | ||
+ | |||
+ | <WRAP group> <WRAP column half> | ||
+ | Take note of the jumper that selects between AC and DC coupling on the BNC adapter. Either will work to measure the sine wave produced here, but some waveforms may find one setting or the other significantly more useful. | ||
+ | </ | ||
+ | {{: | ||
+ | </ | ||
+ | <-- | ||
+ | |||
+ | --> Analog Discovery Pro (ADP3450/ | ||
+ | <WRAP group> <WRAP column half> | ||
+ | Connect a BNC oscilloscope probe to the Analog Discovery Pro's Oscilloscope Channel 1 connector and a set of BNC minigrabbers to its Wavegen Out Channel 1 connector. Connect these together, as pictured, to form a loopback circuit. Check the input probe' | ||
+ | |||
+ | **Note:** //For this demo, both ground wires were not connected together, because the Oscilloscope channel shares the same ground as the Wavegen channel. While BNC Probes are single-ended (as is the Waveform Generator hardware), a connected circuit must still share a common ground with the device. No more than one ground should be connected, in order to avoid the creation of ground loops, which may damage your device.// | ||
+ | |||
+ | **Note:** //When using BNC Probes, make sure to take note of the probes' | ||
+ | </ | ||
+ | {{reference: | ||
+ | </ | ||
+ | <-- | ||
+ | |||
+ | --> Analog Discovery Studio # | ||
+ | <WRAP group> <WRAP column half> | ||
+ | Connect BNC cables to the Test and Measurement device' | ||
+ | |||
+ | **Note:** //For this demo, both ground wires were not connected together, because the Oscilloscope channel shares the same ground as the Wavegen channel. While BNC Probes are single-ended (as is the Waveform Generator hardware), a connected circuit must still share a common ground with the device. No more than one ground should be connected, in order to avoid the creation of ground loops, which may damage your device.// | ||
+ | |||
+ | **Note:** //When using BNC Cables, make sure to take note of the probes' | ||
+ | |||
+ | **Note:** //The Analog Discovery Studio' | ||
+ | |||
+ | </ | ||
+ | {{: | ||
+ | </ | ||
+ | |||
+ | <WRAP group> <WRAP column half> | ||
+ | Make sure to flip the switch that selects between BNC and MTE input for Oscilloscope Channel 1 towards the BNC connector. | ||
+ | </ | ||
+ | {{: | ||
+ | </ | ||
+ | <-- | ||
+ | --> Analog Discovery 2 with BNC Adapter # | ||
+ | <WRAP group> <WRAP column half> | ||
+ | Connect the [[test-and-measurement: | ||
+ | |||
+ | **Note:** //For this demo, both ground wires were not connected together, because the Oscilloscope channel shares the same ground as the Wavegen channel. While BNC Probes are single-ended (as is the Waveform Generator hardware), a connected circuit must still share a common ground with the device. No more than one ground should be connected, in order to avoid the creation of ground loops, which may damage your device.// | ||
+ | |||
+ | **Note:** //When using BNC Probes, make sure to take note of the probes' | ||
+ | </ | ||
+ | {{: | ||
+ | </ | ||
+ | |||
+ | <WRAP group> <WRAP column half> | ||
+ | Take note of the jumper that selects between AC and DC coupling on the BNC adapter. Either will work to measure the sine wave produced here, but some waveforms may find one setting or the other significantly more useful. | ||
+ | </ | ||
+ | {{: | ||
+ | </ | ||
+ | <-- | ||
+ | </ | ||
+ | <-- | ||
+ | ---- | ||
+ | |||
+ | ===== Next Steps ===== | ||
+ | |||
+ | For more guides on how to use the Digilent Test and Measurement Device, return to the device' | ||
+ | |||
+ | For technical support, please visit the [[https:// |