02-17-2011 04:34 PM
Solved! Go to Solution.
02-17-2011 04:52 PM
Welcome to the forums, paynes2!
This is a good place to get answers for myDAQ, but there is another forum for myDAQ as well you can post in.
For now, several of us want to help, but I can't find your program you thought you posted. Can you post it again?
-gaving
02-17-2011 04:54 PM
Sorry about that I'll try again.
I already fixed the button issue. I just didn't have my whole program in a while loop.
Thanks for your time.
02-17-2011 05:43 PM
I didn't know which version of LabVIEW you are using, so I just took a picture of the block diagram after I added a few changes. You should do all of your configuration outside the loop, then just start and stop the task inside the loop. If you only want to get a second's worth of data, just wire your rate into the "samples per channel" input in the DAQmx Timing (Sample Clock) VI. When you wire that to the DAQmx Read, you will wait until you get all of the samples. There's also a "Wait Until Done" that you could use and then read. Anyway, there are several ways to do it. I thought I'd just suggest doing the configuration once and then using stop-start in a loop.
-gaving
02-17-2011 11:02 PM
So if I wanted to take a sample for a certain amount of time, say 60 seconds, what would I do to modify that?
Thanks for the help I really appreciate this.
02-18-2011 01:53 PM
@paynes2 wrote:
So if I wanted to take a sample for a certain amount of time, say 60 seconds, what would I do to modify that?
The above example takes 1 second worth of data. This is achieved by wiring the sample rate to the samples per channel. For instance, if we are running at 1000Hz (or samples per second), we can then ask for 1000 samples. If you want 60 seconds, you can multiple the sample rate by 60 (be sure to increase the timeout on the DAQmx read to >60 seconds). Or you could loop on the read and put the start stop outside that loop. It depends how responsive you want your application to be. If you just want the data, read 60000 samples once with a big timeout, if you want to see some of the data on the front panel, read smaller increments which eventually adds up to 60000.
make sense?
-gaving
02-18-2011 01:54 PM
Thanks,
This makes a lot of sense.
Program is working!