Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying real time Data from Thermocouple and collecting the data

Hi,

I am new to labview and I am trying to create a program for a research lab at a university.  The program is designed to display real-time data and to start collecting data for a specified period of time after a button is pressed.  The problem that I am having is that the data is not displaying on the waveform chart or graph in real-time.  The DAQ assistant is collecting the data then displaying it after n samples are collected.  Right now I have the program set up so you can change the sample rate and the amount of time data will be collected.  The sample rate is then mutiplied by the amount of time to collect and is a control for the sample rate and number of samples collected for the DAQ assistant.  In the attached program I have the DAQ assistant in a case structure in a attempt to have two different sampling rates and number of samples collected but this program gives me an error when I click the record button.   So I guess my question is this is there a way to display the data while the data is being collected instead of waiting for all the data to be collected then display them?  Would it be easier to have the data being displayed every second as in sample rate equal to number of samples to read and munipulate the write to measurment file so that it collects more than one second of data?

 

Thank you for help and time,

Colin 

PS: I want to use this code to collect data from a thermocouple and a voltage reading from a torque sensor

0 Kudos
Message 1 of 10
(4,254 Views)

The DAQ Assistant outputs the entire set of data after it is done reading it, that means when it reaches your graph it is already the entire data set.  The way to get your VI to update as the sensor is read is to "open up" the DAQ Assistant.  Right click the DAQ Assistant and select "Generate DAQmx code"  this will create a DAQmx task that should do exactly what you had your Assistant set to do.  The only difference is there will be a loop you can place your Waveform chart into.  Once inside that loop the chart will update as the data is acquired.  

Regards,

Eric L.
Applications Engineering Specialist
National Instruments
0 Kudos
Message 2 of 10
(4,229 Views)

Hi Eric,

 

Thanks for your help.  I generated the DAQmx code and have been able to get the data to display in real-time but now I cant get the data to record to a measurment file.  The attached code is what i have now.  I deleted the case structure that was around the DAQ assistant before because it was not needed.  Also i deleted a clear tasks block because i thought that might have been preventing it from recording.  How can I get it to record for a certain amount of time and then stop the program once the time is reached?  I have a time elapsed in a case structure but am not sure if that is working.  Also is there a way to change the sample rate of the reader?

 

Thanks again for your help,

Colin

0 Kudos
Message 3 of 10
(4,219 Views)

forgot to attach it, Here it is

0 Kudos
Message 4 of 10
(4,218 Views)

When you changed the Express VI to a regular DAQ task it changed the outputting data-type to a Waveform instead of the dark-blue signal data type, you can change it back with another Express VI.  In express>>signal manipulation there is a "To DDT" VI, select it and drop it down and choose 1D Waveform when it asks for the input data type.  This should make it work with your write to file Express VI.  

Regards,

Eric L.
Applications Engineering Specialist
National Instruments
0 Kudos
Message 5 of 10
(4,207 Views)

Hi Eric,

 

Thanks again for your help.  I tried doing as you suggested and adding the "To DDT". I put the record button and the time elapsed case structure in the while loop with the read block and chart and that seems to be working perfectly.  The program is starting the timer and stopping when time has elapsed.  But im still haveing trouble recording the data.  When time has elapsed the file name and path pops up and I enter the name and path.  But when I open the file after I save it no data had been recorded.  Heres the program as it is now.  I tried adding a shift register to the wave form exiting the while loop but that didnt do anything.  I also tried putting the write to measurment file case structure inside the while loop but that didn't seem to do anything either.

 

Thanks for your help,

Colin

0 Kudos
Message 6 of 10
(4,199 Views)

I forgot to mention in my last post, you should not delete the Clear Task VI, it is necessary for the DAQmx task to run.  After you replace it place a Simple Error Handler VI and connect the error wires.  There is some kind of error preventing the writing to the file I think and you need to know what error it is before we can fix it.  Try running again and see what the error says, there should be some kind of direction in the error message.  

Regards,

Eric L.
Applications Engineering Specialist
National Instruments
0 Kudos
Message 7 of 10
(4,183 Views)

Hi Eric,

 

I attached the clear tasks block again and then added a Simple Error Handler.  But the simple error handler doesnt seem see any error.  Attached is my code.  I might have wired the error handler wrong because I've never used one before.  

 

Thanks again for your help,

Colin 

 

0 Kudos
Message 8 of 10
(4,164 Views)

I might have messed with it and so now it might say it needs a thermocoupleA file so I have attached it here,  If it doesnt disregard this message

0 Kudos
Message 9 of 10
(4,163 Views)

Are you trying to record information about the entire waveform? If so you will need to have your write to file VI inside your loop, otherwise it will just write information about the last data point in the waveform.  Also if you do this you will need to double click you write to file VI and change it to only use the header once, otherwise there will be a header before every dataset.  

Regards,

Eric L.
Applications Engineering Specialist
National Instruments
0 Kudos
Message 10 of 10
(4,146 Views)