LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HELP! VI to record data for set time on button press

I have been asked to develop a VI that can record ECG data to an array and output to TDMS. I am currently using a sine waveform to test the VI as our DAQ is not portable. I have put a VI together, but it has a whole bunch of problems. I have no labview experience, which makes this a lot more difficult than it probably should be. Attached is what I have so far. I have fiddled around with all different types of structures and loops within loops.

 

What I need is:

1. Live data display of about five seconds of data for each of the four channels (currently all showing the same sine waveform, but not five seconds worth. It looks like it displays like a half second of data.

2. Records variable (somewhere between 5-10 seconds) of data at around 1000 Hz (would be nice to be able to control this too) into four arrays and outputs them all to a TDMS file. Current output isn't the full 5 seconds, shows only one channel, and once the record button is pressed it just keeps spitting out files until you stop the vi manually. I tried putting in a "for" loop that runs once, but it ignores this and runs the same way.

 

I have attached one of my many VI attempts, as well as a sample of the output data.

Download All
0 Kudos
Message 1 of 3
(2,194 Views)

@TheNuclearkirk1 wrote:

1. Live data display of about five seconds of data for each of the four channels (currently all showing the same sine waveform, but not five seconds worth. It looks like it displays like a half second of data.


Change your graphs into a single Chart.  Charts have a history built into them.  So if you know your sample rate, you can figure out how large of a history you need to get 5 seconds worth of display.  You can then wire your DAQ data directly to the chart.

 


@TheNuclearkirk1 wrote:

2. Records variable (somewhere between 5-10 seconds) of data at around 1000 Hz (would be nice to be able to control this too) into four arrays and outputs them all to a TDMS file. Current output isn't the full 5 seconds, shows only one channel, and once the record button is pressed it just keeps spitting out files until you stop the vi manually. I tried putting in a "for" loop that runs once, but it ignores this and runs the same way.


Look at using the Elapsed Time VI.  It will allow you to set a target time and it will tell you when that time has elapsed.  Use you "record" button to reset it when you press the button and only record when the output is FALSE.  There is absolutely no reason to have a loop within a loop.

 

General note:  You really should try to avoid those Express VIs and the Dynamic Data Type.  They tend to abstract too much and the understanding of what the data actually is is often lost to users.  You can do a lot better by using the normal VIs.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(2,136 Views)

@TheNuclearkirk1 wrote:

I have no labview experience, which makes this a lot more difficult than it probably should be.


Yes, doing almost anything without any experience makes progress difficulty (remind me not to come to you for Brain Surgery).  The Next Best Thing to a LabVIEW Guru to whom you can apprentice yourself are the numerous Tutorials and Training Videos for LabVIEW, but you do need to spend a few hours reading/viewing them and doing as many examples (and practicing writing VIs) as you can.

 

To "cure" yourself of the Dreaded DAQ Assistant and its evil twin, the Dynamic Data Wire, (after you've spent, say, 6-9 hours with Basic LabVIEW Tutorials) find the DAQmx Tutorial set, particularly this excellent NI White Paper.

 

Bob Schor

0 Kudos
Message 3 of 3
(2,129 Views)