Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
daq-and-datalogging:documents:ulx-for-ni-labview-3 [2023/07/05 09:21] – Scandiwebdaq-and-datalogging:documents:ulx-for-ni-labview-3 [2023/07/28 00:51] (current) – Arthur Brown
Line 1: Line 1:
-====== Getting started with ULx for NI LabVIEW Part 3 ======+====== Getting Started with ULx for NI LabVIEW Part 3 ======
 In part 2, we enhanced the VI we created in part 1 by adding the ability to acquire data at a steady rate, display the data in a stripchart, save the data to a log file, and notify the operator if is there is an error.  In this third and final part, we will enhance what we have done so far, by adding: In part 2, we enhanced the VI we created in part 1 by adding the ability to acquire data at a steady rate, display the data in a stripchart, save the data to a log file, and notify the operator if is there is an error.  In this third and final part, we will enhance what we have done so far, by adding:
  
Line 12: Line 12:
 Here is where we left of in part 2; our Block Diagram and Front Panel looked like this: Here is where we left of in part 2; our Block Diagram and Front Panel looked like this:
  
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 13.png?632x283}} +<WRAP centeralign> 
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 12.png?382x442}}+{{https://files.digilent.com/reference-images/picture 13.png?632x283}} 
 +</WRAP> 
 + 
 +<WRAP centeralign> 
 +{{https://files.digilent.com/reference-images/picture 12.png?382x442}} 
 +</WRAP>
  
 **Scaling** **Scaling**
Line 42: Line 47:
 Let’s start by making our While Loop wider.  Hover your cursor over the While Loop’s right drag handle (small blue square), and stretch the loop to the right, doubling the width of the loop.  Next we need to move the Write to Measurement file.VI, Waveform Chart.VI and Data.VI over to the right as well. Sure, you can drag them one by one but then you have to clean up your wiring.  Instead, place the cursor to the right and just above the Write to Measurement File.VI, hold down the left mouse button, drag a rectangle around the 3 VIs and their wiring and release the left mouse button.  You’ll see you have now grabbed all 3 VIs and their wiring.  Now hover your mouse over the Write to Measurement file.VI, hold down the left mouse button and drag the group of VIs and wires to the right.  It should look like this: Let’s start by making our While Loop wider.  Hover your cursor over the While Loop’s right drag handle (small blue square), and stretch the loop to the right, doubling the width of the loop.  Next we need to move the Write to Measurement file.VI, Waveform Chart.VI and Data.VI over to the right as well. Sure, you can drag them one by one but then you have to clean up your wiring.  Instead, place the cursor to the right and just above the Write to Measurement File.VI, hold down the left mouse button, drag a rectangle around the 3 VIs and their wiring and release the left mouse button.  You’ll see you have now grabbed all 3 VIs and their wiring.  Now hover your mouse over the Write to Measurement file.VI, hold down the left mouse button and drag the group of VIs and wires to the right.  It should look like this:
  
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 3_1.png?604x276}}+<WRAP centeralign> 
 +{{https://files.digilent.com/reference-images/picture 3_1.png?604x276}} 
 +</WRAP>
  
 Since everything we’re to do is in this loop, then that is the portion shown. Since everything we’re to do is in this loop, then that is the portion shown.
Line 72: Line 79:
 Your diagram should look like this: Your diagram should look like this:
  
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 3_2.png?603x277}}+<WRAP centeralign> 
 +{{https://files.digilent.com/reference-images/picture 3_2.png?603x277}} 
 +</WRAP>
  
 Here is our Front Panel, running with the new changes: Here is our Front Panel, running with the new changes:
  
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 3_3.png?383x442}}+<WRAP centeralign> 
 +{{https://files.digilent.com/reference-images/picture 3_3.png?383x442}} 
 +</WRAP>
  
  Note that it looks about the same as it did before, but the data is 200 times what it was originally and so are the Y axis labels on the chart.  Note that it looks about the same as it did before, but the data is 200 times what it was originally and so are the Y axis labels on the chart.
Line 95: Line 106:
 Your block diagram and front panel should like this: Your block diagram and front panel should like this:
  
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 3_4.png?607x333}}+<WRAP centeralign> 
 +{{https://files.digilent.com/reference-images/picture 3_4.png?607x333}} 
 +</WRAP>
  
 To simulate the pressure sensor, use a variable power supply, one that can output from 0 to 5VDC.  If you have not already done so, attach the output of the power supply to Channel 0 (CH0H) of the USB-1608G.  If you the USB-1608G is configured for single ended inputs, connect the power supply’s ground to an AGND terminal of the USB-1608G.  If it is set up for differential ended inputs, then wire it as above and install a jumper wire from CH0L to AGND.  Set the output of the power supply to 0VDC, and run your VI.  The Indicator will turn on when the output of the power supply reaches and exceeds 3.75V (750 PSI ÷ 200 PSI/V = 3.75 V), and off when below 3.75V. To simulate the pressure sensor, use a variable power supply, one that can output from 0 to 5VDC.  If you have not already done so, attach the output of the power supply to Channel 0 (CH0H) of the USB-1608G.  If you the USB-1608G is configured for single ended inputs, connect the power supply’s ground to an AGND terminal of the USB-1608G.  If it is set up for differential ended inputs, then wire it as above and install a jumper wire from CH0L to AGND.  Set the output of the power supply to 0VDC, and run your VI.  The Indicator will turn on when the output of the power supply reaches and exceeds 3.75V (750 PSI ÷ 200 PSI/V = 3.75 V), and off when below 3.75V.
Line 122: Line 135:
 Lastly, to complete the error handling, while we could add an additional Simple Error.VI, we can make our block diagram more efficient if we keep only the original one with its settings.  Add a Merge Errors.VI to the block diagram.  Depending on the version of NI LabVIEW, it will either appear as shown below if using Version 2009, or in the newer versions it looks like this .  Wire it as shown: Lastly, to complete the error handling, while we could add an additional Simple Error.VI, we can make our block diagram more efficient if we keep only the original one with its settings.  Add a Merge Errors.VI to the block diagram.  Depending on the version of NI LabVIEW, it will either appear as shown below if using Version 2009, or in the newer versions it looks like this .  Wire it as shown:
  
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 3_11.png?960x337}} +<WRAP centeralign> 
 +{{https://files.digilent.com/reference-images/picture 3_11.png?960x337}} 
 +</WRAP>
  
 To detect the operation of the digital bit (DIO0), connect it to a digital volt meter, and use the terminal GND for your meter’s ground.  Set the output of the power supply to 0VDC, and run your VI.  As before, the Indicator will turn on when the output of the power supply reaches and exceeds 3.75V and DIO0 will output about 5VDC, below 3.75V, the Indicator will turn off and DIO0 will drop to 0VDC. To detect the operation of the digital bit (DIO0), connect it to a digital volt meter, and use the terminal GND for your meter’s ground.  Set the output of the power supply to 0VDC, and run your VI.  As before, the Indicator will turn on when the output of the power supply reaches and exceeds 3.75V and DIO0 will output about 5VDC, below 3.75V, the Indicator will turn off and DIO0 will drop to 0VDC.
Line 129: Line 143:
 A view of the completed and running Front Panel: A view of the completed and running Front Panel:
  
-{{https://files.digilent.com/resources/measurement-computing/Reference Images/picture 3_12.png?382x442}}+<WRAP centeralign> 
 +{{https://files.digilent.com/reference-images/picture 3_12.png?382x442}} 
 +</WRAP>
  
 As we have seen in all three parts of this article, it is easy to use NI LabVIEW with Measurement Computing hardware to measure analog signals, manipulate the data and control digital IO.  This is just a simple example of what you can do with tools such as these.  The list is endless! As we have seen in all three parts of this article, it is easy to use NI LabVIEW with Measurement Computing hardware to measure analog signals, manipulate the data and control digital IO.  This is just a simple example of what you can do with tools such as these.  The list is endless!