LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring sound signals from a microphone using USB-6009 DAQ hardware

I'm currently trying to do a bit of a review on some labview topics and I'm having the same problems I encountered earlier.

 The issue is that I'm having a hard time designating a file path for the file writer VI below. When I run the VI, it gives an error message instead of the dialog box where the file path will be entered.  It kept giving the error message below each time I run the VI.

 

 "Error 1430 occurred at Open/Create/Replace. Possible reasons:

Labview: The path is empty. You must use an absolute path"

 

I will appreciate some help in this regard. Please see attached VI.

0 Kudos
Message 31 of 41
(1,961 Views)

Hey Mbdeck!

 

There are two ways to fix this issue.  The first method is to go to the front panel and right click on the 'File Path' Control and select 'Visible Items' and then select 'Browse Button.'  This will add a standard file dialog to the control so that you can navigate to the file you're trying to open.  One more thing we'll need to do if you're trying to select the path for a new file is right click on the 'File Path' Control again and select 'Browse Options.'  Make sure the 'New or Existing' radio button is selected, as well as 'File or Folders.'

 

If you want the user to provide the path at runtime, place the 'File Dialog' Express VI (Programming»File I/O»Advanced File Functions).

 

It's that easy!

-John Sullivan
Problem Solver
0 Kudos
Message 32 of 41
(1,942 Views)

Knights W..,

 

I was able to fix the problem thanks. I do have a couple more questions.

 

First question.

 

I'm trying to write the code for a temperature aplication but the "hint" in the question suggested using multiple "Build text expess VI" in the code. That suggestion has left me a bit confused. Do you know why I'd need multiple build text express VI in this problem?. The statement in the "tip" about the Build text VI being limited to eight inputs still didn't make a lot of sense to me. I thought one should be enough. Here is the problem as outlined below:

 

Build a VI that performs the following tasks.

  1. Takes a temperature measurement once every second until you stop the VI or an error occurs.
  2. Displays both the current temperature and the average of the last three measurements on a waveform chart.
  3. If the temperature exceeds a limit, turns on an LED.
  4. After each measurement, logs the date, time including seconds, temperature, average of the last three measurements, and a one-word message describing whether the temperature is normal or over the limit. Logs data so each item appears in one column of a spreadsheet, as shown in Figure 1.
  5. After you stop the acquisition, plots both the raw temperature data and a best-fit curve in an XY graph and displays the average, maximum, and minimum temperatures.

tip: The Build Text Express VI is limited to eight inputs. Use multiple Build Text Express VIs 

I've attached images of the fig1 spreadsheet and VI front panel. 

 

Second question.

 

I received help in this forum a few months ago with coding a threshold VI and I thought I understood it but looking at it now, I realize that I'd need a bit more explanation to understand the code fully.  Please include in your response the reason why auto indexing was disabled for the two inputs into For loop.

 

I know the stuff I just presented might seem like a lot but I'm just stuck and I can't help it.

 

Thanks and I'll appreciate your in puts.

 

0 Kudos
Message 33 of 41
(1,932 Views)

Hey Mbdeck,

The tip that is causing confusion is simply saying if you have more than 8 text items you will need to use multiple Build Text Express VIs to accomodate the additional inputs and then serially connect the resulting VIs to merge all text together.  For this example this isn't neccessary unless you are using more than 8 text items. To add additional parameters all you need to do is double click on the express VI and type in the syntax for your parameters up to 8 items (for example: a, b, c would be entered as "%a%,%b%,%c%" without quotes).

 

Auto indexing is disabled in your threshold inputs because we are operating on your array as a whole, not per element.  Say we have an array with values [1 2 3 4 5].  If we auto index the array input, the first time through the loop the numeric input will have a value of [1] and won't be an array at all so it'll just be '1'.  Now if we try to index the numeric at position N, we will get an error because the input is not an array.  In your code, since we operate on our array inside of the for loop, we need to have the original array data each iteration in order to search for the next true condition and then index out the correct array element to build our resulting array.

-John Sullivan
Problem Solver
0 Kudos
Message 34 of 41
(1,901 Views)

Knight w.

 

Your response cleared up a lot of confusion. It was very helpful. Thank you.

0 Kudos
Message 35 of 41
(1,887 Views)

Knights W..

 

I've ran into a problem and I need help.  I wrote the code for the VI I posted above and it doesn't work. Here is the question again:

 

Build a VI that performs the following tasks.

  1. Takes a temperature measurement once every second until you stop the VI or an error occurs.
  2. Displays both the current temperature and the average of the last three measurements on a waveform chart.
  3. If the temperature exceeds a limit, turns on an LED.
  4. After each measurement, logs the date, time including seconds, temperature, average of the last three measurements, and a one-word message describing whether the temperature is normal or over the limit. Logs data so each item appears in one column of a spreadsheet, as shown in Figure 1.
  5. After you stop the acquisition, plots both the raw temperature data and a best-fit curve in an XY graph and displays the average, maximum, and minimum temperatures.

tip: The Build Text Express VI is limited to eight inputs. Use multiple Build Text Express VIs 

Issues:

It doesn't display in excel as described in the question.

I couldn't wire it to display the date

It doesn't display comments

It doesn't plot a best fit curve

 

I've attached my VI and what the spreadsheet is supposed to look if done correctly.

 

Please take look at my code in the block diagram and see where I can make corrections to get it to work. 

 

NB: I copied the thermometer sub VI in the in the code from the "temperature system demo VI" in the find examples section to simulate temperature data.

 

I'll appreciate any inputs.

 

Thanks

 

  

Download All
0 Kudos
Message 36 of 41
(1,849 Views)

Hey Mbdeck,

 

FYI we like to keep forum posts modular and targeting a specific issue.  In the future, please post new issues in a new forum post. 

 

For today, here are my recommendations:

 

1. Please explain this in more detail.

2. I'd recommend using "Get Date/Time in Seconds" to actually get the time.  "Get Date/Time String" extracts said values from an input string.  For the time, I'd recommend plugging the 'Current Time' output from "Get Date/Time in Seconds" into the 'Time Stamp' input of "Get Date/Time String".

3. You don't get the comments because you don't have anything wired up to the 'comment' input of the build text VI.

4. I don't quite understand what you're expecting to plot a best fit curve.  It looks like you're trying to build a simple XY Graph at the end of your VI.  If this is the case, I would recommend using the XY Graph Indicator.  If this isn't the case, please describe in more detail what it is you're trying to do.

-John Sullivan
Problem Solver
0 Kudos
Message 37 of 41
(1,818 Views)

Hi Knights W,

 

Here is what the VI is supposed to do:

  1. Takes a temperature measurement once every second until you stop the VI or an error occurs.
  2. Displays both the current temperature and the average of the last three measurements on a waveform chart.
  3. If the temperature exceeds a limit, turns on an LED.
  4. After each measurement, logs the date, time including seconds, temperature, average of the last three measurements, and a one-word message describing whether the temperature is normal or over the limit. Logs data so each item appears in one column of a spreadsheet, as shown in Figure 1.
  5. After you stop the acquisition, plots both the raw temperature data and a best-fit curve in an XY graph and displays the average, maximum, and minimum temperatures.

 Yes, it is supposed to plot both the raw temperature data and the best fit curve.

 

I'll start a new thread next time. My appolgies....

 

 

0 Kudos
Message 38 of 41
(1,814 Views)
Hello Mbdeck,

  1. It looks like this part of your code is correct. You have the loop execution timing set to 1000 ms with the stop condition set to happen if either the stop button is pressed or there is an error condition.  The only change here is that you should read the status after your Write to Text File VI, not before.
  2. In order to take the average of the last three measurements you will need to divide the value coming out of the add function by 3.
  3. This part looks correct.
  4. You need to look at your formatting in the building of this text file. What kind of delimiter do you need between fields? It is comma or tab delimited? You could try to insert these delimiters between each of the parameters in the Express VI setup. Also, you should be writing your column headers before entering into the loop.
  5. It looks like there shouldn't be any problems with the last step either, except that you should be using a Waveform Graph, not a XY Graph.

Regards,
Dan King

0 Kudos
Message 39 of 41
(1,776 Views)

Hi Dan K

 

Thanks for the response. I don't quite understand your question regarding delimiters.  In the "Build text VI", I used tab and end of Line to put the parameters in a spreadsheet format. For example, here is how I entered them in the dialog box of the "build text VI" :

 

%tab%%date%%time%%temp%%Avg%%comment%%end%

 

From the above, I'm not quite sure if I'd say that the tab is the delimiter here or the %.  What is the role of delimiters?. Is the % the delimiter here?. How would a comma change things and in what situations can "commas" be used as a "delimiter" ?.

 

What do mean by this statement below?. Can you explain it a bit more?.

"Also, you should be writing your column headers before entering into the loop"

 

 

 

 

0 Kudos
Message 40 of 41
(1,742 Views)