{"id":16778,"date":"2016-10-03T10:00:03","date_gmt":"2016-10-03T17:00:03","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=16778"},"modified":"2023-01-09T09:23:12","modified_gmt":"2023-01-09T17:23:12","slug":"using-the-analog-discovery-2-in-labview","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/using-the-analog-discovery-2-in-labview\/","title":{"rendered":"Using the Analog Discovery 2 in LabVIEW"},"content":{"rendered":"<p>My latest\u00a0project involved\u00a0an attempt to recreate some of the basic features of <a href=\"https:\/\/digilent.com\/shop\/waveforms-2015-download-only\/\">Digilent Waveforms<\/a> in <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a>. My LabVIEW VI, called Labforms, allows you to\u00a0connect an\u00a0<a href=\"https:\/\/digilent.com\/shop\/analog-discovery-2-100msps-usb-oscilloscope-logic-analyzer-and-variable-power-supply\/\">Analog Discovery 2\u00a0<\/a>USB Oscilloscope to LabVIEW. The LabVIEW code uses the\u00a0<a href=\"https:\/\/decibel.ni.com\/content\/docs\/DOC-44838\">LabVIEW driver for the Analog Discovery 2<\/a>,\u00a0which lets you access the analog scope and Waveform Generator\u00a0(WaveGen)\u00a0functionalities of the Analog Discovery with LabVIEW.<\/p>\n<p><span style=\"font-size: 14px;\">In this post, I will walk you through the Labforms user interface.<\/span><\/p>\n<p><strong><u>Waveform Generator<\/u><\/strong><\/p>\n<div style=\"width: 735px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-16778-1\" width=\"735\" height=\"465\" poster=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/08\/Capture4-1.png\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/09\/FSWPZRZITVOMWMU.mp4?_=1\" \/><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/09\/FSWPZRZITVOMWMU.mp4\">https:\/\/digilent.com\/blog\/wp-content\/uploads\/2017\/09\/FSWPZRZITVOMWMU.mp4<\/a><\/video><\/div>\n<p>The WaveGen tab allows you to generate electronic waveforms. The resulting waveforms can be input into a device being tested and analyzed with the Oscilloscope as they progress through the device. This is useful for confirming the proper operation of the device or pinpointing a fault in the device.<\/p>\n<ul>\n<li><strong>Channels<\/strong>:\u00a0selects the channel(s) to be controlled. For every channel you select, a configuration form and a signal preview plot are displayed.\n<ul>\n<li>Channel One is Waveform Generator channel 1<\/li>\n<li>Channel Two is Waveform Generator channel 2.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Waveform Function<\/strong>: represents the standard signal types: DC, Sine, Square, Triangle.<\/li>\n<li><strong>Frequency<\/strong>: adjusts the generated waveform period.<\/li>\n<li><strong>Amplitude<\/strong>: shows the amplitude for the Carrier signal.<\/li>\n<li><strong>DC Offset<\/strong>: adjust the offset in volt units.<\/li>\n<li><strong>Duty Cycle<\/strong>:\u00a0Specifies the percentage of time the waveform is in an active state<\/li>\n<\/ul>\n<p><strong><u>Power Supplies<\/u><\/strong><\/p>\n<div style=\"width: 735px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-16778-2\" width=\"735\" height=\"463\" poster=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_.jpg\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/10\/FTZSAAQITVOMTN2.mp4?_=2\" \/><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/10\/FTZSAAQITVOMTN2.mp4\">https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/10\/FTZSAAQITVOMTN2.mp4<\/a><\/video><\/div>\n<p>This instrument allows you to enable the device power supplies.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16751 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.04.34-AM-600x324.png\" alt=\"screen-shot-2016-09-15-at-10-04-34-am\" width=\"600\" height=\"324\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.04.34-AM-600x324.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.04.34-AM-768x414.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.04.34-AM-1024x552.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.04.34-AM-800x431.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.04.34-AM.png 1237w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<ul>\n<li><strong>Master Enable is ON\/OFF<\/strong>\u00a0button: the master ON\/OFF switch for the power supplies.<\/li>\n<li><strong>Positive\/Negative Supply<\/strong>\u00a0button: the enable switches for each supply.\n<ul>\n<li>&#8220;Rdy&#8221; is shown when the master switch is on, and the supply is also enabled.<\/li>\n<li>&#8220;OFF&#8221; is shown when the supply is not enabled.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Voltage<\/strong>\u00a0fields: This allows you to adjust values for the power supplies by either selecting a value from the combo box\u00a0or typing it in.<\/li>\n<\/ul>\n<p><strong><u>Oscilloscope<\/u><\/strong><\/p>\n<div style=\"width: 735px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-16778-3\" width=\"735\" height=\"463\" poster=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_.jpg\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/10\/F99HUSUIZ6CT8BY.mp4?_=3\" \/><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/10\/F99HUSUIZ6CT8BY.mp4\">https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/10\/F99HUSUIZ6CT8BY.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<p>An oscilloscope (or \u201cscope\u201d) allows you to view signal voltages, typically in a two-dimensional graph where one or more electrical potential differences (on the vertical axis) are plotted as a function of time or of some other voltage (on the horizontal axis).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16752 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.02.52-AM-600x325.png\" alt=\"screen-shot-2016-09-15-at-10-02-52-am\" width=\"600\" height=\"325\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.02.52-AM-600x325.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.02.52-AM-768x416.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.02.52-AM-1024x554.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.02.52-AM-800x433.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.02.52-AM.png 1241w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>Channels<\/strong><br \/>\nUse the real channel (vertical controls) to position and scale the waveforms vertically using the offset and range controls for each channel.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16754 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.49-AM.png\" alt=\"screen-shot-2016-09-15-at-10-25-49-am\" width=\"197\" height=\"171\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.49-AM.png 197w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.49-AM-110x96.png 110w\" sizes=\"auto, (max-width: 197px) 100vw, 197px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-16753 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.57-AM.png\" alt=\"screen-shot-2016-09-15-at-10-25-57-am\" width=\"197\" height=\"173\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.57-AM.png 197w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.57-AM-110x96.png 110w\" sizes=\"auto, (max-width: 197px) 100vw, 197px\" \/><\/p>\n<ul>\n<li><strong>Offset<\/strong>:\u00a0The offset (vertical position) control lets you move the waveform up or down to exactly where you want it on the screen. The offset is the voltage difference between the center line of the oscilloscope screen and the actual ground. This difference is generated by an internal offset voltage source.<\/li>\n<li><strong>Range<\/strong>:\u00a0The range (volts\/division) controls to determine the vertical scale of the graph drawn on the oscilloscope screen. The volts\/div setting is a scale factor. For example, if the volts\/div setting is 2 volts, then each of the ten vertical divisions represents 2 volts, and the entire screen can show 20 volts from bottom to top. If the setting is 0.5 volts\/div, the screen can display 5 volts from bottom to top, and so on. The maximum voltage you can display on the screen is the volts\/div setting multiplied by the number of vertical divisions.<\/li>\n<\/ul>\n<p><strong>Time group<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16755 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.33-AM.png\" alt=\"screen-shot-2016-09-15-at-10-25-33-am\" width=\"194\" height=\"159\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.33-AM.png 194w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.33-AM-168x137.png 168w\" sizes=\"auto, (max-width: 194px) 100vw, 194px\" \/><\/p>\n<ul>\n<li><strong>Base<\/strong>: The time base (seconds\/division) setting from the channel configuration toolbar lets you select the rate at which the waveform is drawn across the screen. This setting is a scale factor. For example, if the setting is 1 ms, each horizontal division represents 1 ms and the total screen width represents 10 ms (ten divisions). Changing the sec\/div setting allows you to visualize longer or shorter time intervals of the input signal.<\/li>\n<li><strong>Sample Rate<\/strong>: Adjusts the sampling frequency.<\/li>\n<\/ul>\n<p><strong>Triggers<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16757 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.14-AM.png\" alt=\"screen-shot-2016-09-15-at-10-25-14-am\" width=\"440\" height=\"123\" \/><\/p>\n<ul>\n<li><strong>Trigger level<\/strong>: specifies, in volts, the levels at which to trigger<\/li>\n<li><strong>Trigger Instance<\/strong>: specifies the trigger instance. This parameter accepts only A as an input<\/li>\n<li><strong>Trigger Slope<\/strong>: Specifies on which edge of the source signal to trigger<\/li>\n<li><strong>Trigger\u00a0Hysteresis<\/strong>: specifies, in volts, a window below Trigger level.\n<ul>\n<li>If the edge is rising, the input voltage must pass below Trigger Level minus Trigger Hysteresis before the input voltage is recognized as a trigger.<\/li>\n<li>Hysteresis can improve measurement accuracy when the signal contains noise or jitter.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Cursors<\/strong><\/p>\n<p>The Cursors are used to measure the amplitude, to indicate certain places on the waveform. Using delta cursors, you can make measurements that deal with power change with frequency or time.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16756 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-10.25.24-AM.png\" alt=\"screen-shot-2016-09-15-at-10-25-24-am\" width=\"460\" height=\"123\" \/><\/p>\n<p>These can be added by switching on the &#8220;Cursor 1&#8221; or &#8220;Cursor 2&#8243; switches&#8221; above the plot. The first cursor\u00a0is by default added as a normal cursor, if you turn on both cursors you will not only see the X and Y position of each cursor, but you will also see the Delta, showing the difference between the position of each cursor. The cursor position can be modified with a mouse drag.<\/p>\n<p><strong>Possibilities\u00a0<\/strong><\/p>\n<p><a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a>\u00a0ability to interface with the Analog Discovery 2 opens up a world of possibilities. Labforms can be used as a simple alternative to Waveforms or it can take advantage of LabVIEW ability to create customized and advanced measurement tasks. The Analog Discovery 2 is a great addition to any LabVIEW project, you can easily pair it with a <a href=\"https:\/\/digilent.com\/shop\/chipkit-wf32-wifi-enabled-microntroller-board-with-uno-r3-headers\/\">WF32<\/a>, a <a href=\"https:\/\/digilent.com\/shop\/labview-physical-computing-kit-for-raspberry-pi-2\/\">Raspberry Pi 2<\/a>, a <a href=\"https:\/\/digilent.com\/shop\/labview-physical-computing-kit-for-beaglebone-black\/\">BeagleBone Black<\/a>, and any number of <a href=\"https:\/\/www.labviewmakerhub.com\/doku.php?id=blog:users:makerhub:2016-04-07-linx-3\">LINX <\/a>compatible devices.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16745 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_-600x375.jpg\" alt=\"feigq03iscbo1ey-large\" width=\"600\" height=\"375\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_-600x375.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_-768x480.jpg 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_.jpg 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_-343x215.jpg 343w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_-800x500.jpg 800w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Thank you for reading my blog post; if you want to learn more, please check out my Instructable &#8220;<a href=\"http:\/\/www.instructables.com\/id\/Analog-Discovery-2-USB-Oscilloscope-LabVIEW2016-Up\/\">Analog Discovery 2 USB Oscilloscope + LabVIEW(2016 update)<\/a>&#8220;. \u00a0If you are interested in making this project yourself but don&#8217;t have the right supplies, you can purchase\u00a0LabVIEW 2014 home bundle\u00a0<a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">here<\/a>, and if you are a student the\u00a0<a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">Analog Discovery 2<\/a>\u00a0has an academic discount available. Please comment below with any questions or comments you may have!<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-16778 jlk' data-task='like' data-post_id='16778' data-nonce='a7fc8cf7e3' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-16778 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-16778 jlk' data-task='unlike' data-post_id='16778' data-nonce='a7fc8cf7e3' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-16778 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-16778 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Austin combines the Analog Discovery 2 with LabVIEW to create Labforms!<\/p>\n","protected":false},"author":42,"featured_media":16745,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4323,4312,1561],"tags":[111,1736],"ppma_author":[4493],"class_list":["post-16778","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","category-usb-scopes-analyzers-generators","category-applications","tag-analog-discovery","tag-analog-discovery-2"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FEIGQ03ISCBO1EY.LARGE_.jpg","authors":[{"term_id":4493,"user_id":42,"is_guest":0,"slug":"astanton","display_name":"Austin Stanton","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/056fddaefc60a1f99c226ea5757a8c41?s=96&d=mm&r=g","author_category":"","user_url":"","last_name":"Stanton","last_name_2":"","first_name":"Austin","first_name_2":"","job_title":"","description":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/16778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=16778"}],"version-history":[{"count":2,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/16778\/revisions"}],"predecessor-version":[{"id":29463,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/16778\/revisions\/29463"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/16745"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=16778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=16778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=16778"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=16778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}