10-06-2014 05:54 PM
I managed to collect 16 channels of analog signals (write to measurement file VI) manually using a boolean start/stop control. I would like to allow the user to set a sample duration on the front panel (e.g., 20 seconds) and initiate the sampling by clicking a start button. The user can also terminate the data dump before the end of the set duration by clicking a stop button. I looked at several countdown timer examples but couldn't figure out how to incorporate it to my VI. Any suggestions and examples will be much appreciated.
Solved! Go to Solution.
10-06-2014 06:18 PM
You could change the DAQ Tasks to be Finite Samples. The number of samples would be the duration divded by the sample rate. Use the DAQmx Task Done VI to check to see if the task is complete.
10-07-2014 02:37 PM
I tried opening your VI in both LabVIEW 2013 and LabVIEW 2014 -- all I got was a blank screen with what looked like labels for 3 controls or constants. So I'm unclear why you are having trouble, as it should be a very easy task to use DAQmx to (a) configure your 16-channel A/D task, (b) start acquisition, (c) stream the data to disk, and (d) stop it at any time using a boolean Stop button.
If you want to stream data, you should consider a Consumer/Producer pattern -- have the loop generating the samples (the A/D loop) running at some fixed speed (your sampling rate) put the data onto a Queue. Have a Consumer loop looking at the Queue, and as fast as stuff appears on it, take it off and write it to disk. Note that when stopping the system, you want to stop the Producer first, and stop the Consumer only after it finishes writing the data to disk (it should "time out" while waiting to dequeue stuff).
BS
P.S. -- if something I've written doesn't make sense or sound familiar, consider looking at Examples or doing a Web search -- you'll learn a lot. Also, there are some awesome tutorials on DAQmx on the NI site.
10-07-2014 03:19 PM
Thanks for the responses. I have attached the vi in pdf. I have found a timer program online and will try to incorporate it in my VI to control the duration of data dump (write to measurement file).
10-07-2014 05:37 PM
No, you've attached some pictures of your VI. Why not just attach the VIs themselves? It would've been quicker to do that than to take screen shots and convert it to pdf and upload it.
10-07-2014 08:56 PM
10-10-2014 02:00 PM
Thanks for the pointer ... the Elapsed Time function gives me the results I want. Yes, I have 2 devices - a USB-6008 and a USB-6009. Not sure if they can be synced since each has only 1 PFI line. From what I read, you need 2 PFI line to sync 2 devices -- 1 for timeing and the other for triggering.
10-10-2014 02:11 PM
@billko wrote:
No, you've attached some pictures of your VI. Why not just attach the VIs themselves? It would've been quicker to do that than to take screen shots and convert it to pdf and upload it.
What he did was sort of interesting (and probably pretty fast). Apparently he printed the block diagram directly to pdf output using the print command and a special print driver (I have one of those too!).
This has clear advatages over screenshots, because it also shows all other cases of case structures.
Still, We always prefer actual VIs. 😄
10-10-2014 02:21 PM
Knight of NI: I attached a VI with my first post but Bob_Schor was not able to open it (or just blank). That's why I attached pdfs. I here attach a VI (created using LV 2013 SP1) and see if you can open it.
10-10-2014 02:25 PM
It is not clear is you want the user to select (1) 20 seconds of indvidual measurements or (2) 20 seconds worth of your measurement sets that are 1000 data points at 1000 Hz. If (1) then your timing needs to be handled in the task setup. If (2) then your timing needs to be handled in the loop.
I have found setting up DAQ task in NI MAX or directly into the project to be easier and less cluttered. But I guess that is more of a preference.