05-30-2014 10:17 AM
Hi,
I am using a while loop to record data. I begin recording data of voltage. I have it set up so as soon as the voltage reaches a certain point it stops and begins to record acceleration through an accelerometer. When I do this the program works fine, and records the data, but there is a time delay from when the voltage stops recording and the acceleration begins recording. This time delay is around .3 seconds. This doesn't seem like much but I need the program to be instantaneous with no delay. Is there anything I could be doing wrong.
Thanks for the help.
05-30-2014 10:23 AM
ryan1212 wrote: Is there anything I could be doing wrong.
Yes. There are lots of things you could be doing wrong. It would help if you supplied some code to look at.
05-30-2014 10:33 AM
Yes sorry. Here it is.
05-30-2014 10:40 AM
You probably don't want to use express VIs for this (we cannot tell from the picture how things are configured).. Prepare both tasks outside the loop at the beginning, then just trigger them one after the other.
05-30-2014 10:44 AM
Well, it does take time to write data to a file. But 300ms sounds a little on the high side. It could also be the creation of the second task taking some time before it can actually start running. Between those two, 300ms seems plausible.
Look in the Example Finder (Help->Find Examples) for a DAQmx Analog Input. I suggest learning to use the "real" DAQmx API and getting away from the Express VIs that you are using. By doing this, you can set up both of your tasks before anything begins and start your second task as soon as you find your start condition.
05-30-2014 10:46 AM
You will need to use the DAQmx API to solve your delay. There is unnecessary overhead in DAQ assistant express vis since the Tasks need to be created verified reserved and started on the first iteration and Checked on each subsequent iteration (not to mention the implicit state transition caost some time too)
If you Right-click the DAQ assistant you can "Generate Code>>Configuration and example" then migrate the configuration before the loop and the clear task after the loop.
Something like this:
Which was all generated from "Generate code although I did "Pull in" the create vi to the main BD to make the snippette complete without the subvi
05-30-2014 11:30 AM
Hi sorry, we are fairly new to LabVIEW. Can you give me a little more of an explanation of how your program works? Such as where your data is being recorded. Also we can get a voltage reading now, how do we set it up to trigger the accelerometer?
Thanks again.
05-30-2014 12:15 PM
@ryan1212 wrote:
Hi sorry, we are fairly new to LabVIEW. Can you give me a little more of an explanation of how your program works? Such as where your data is being recorded. Also we can get a voltage reading now, how do we set it up to trigger the accelerometer?
Thanks again.
First that's a snippet drag it to your desktop- then drag it to an empty Block Diagram in LabVIEW 2013. the code will <Poof> into existance. The help file will explan the functions. If you have further questions after peering at the help file I will reply.
Logging was not part of my example- merely a way to move from the DAQ assistant to DAQmx API function calls. I added Logging to this snippet so you could easilly see how to remove the other express vis and use more of the "non-expressvi" advantages.
05-30-2014 12:55 PM
I have the data recorded now, but I cant seem to figure out how to alter the stop condition so that when my voltage reading is below 8V the loops stops iterating. Beginning the accelerometer DAQ. I tried to use the boolean less than (<) condition with the data going into the top slot and a constant of 8 coming out of the bottom, and the tip going to the stop function.
Any help again would be appreciated!
05-30-2014 01:09 PM
You probably want a Greaer than or equal to set to Compare Aggrigates (which returns false if any value is below 😎 and a not