09-14-2010 06:26 PM
Hi,
Here is what I want to do.I would like to show using an numeric indicator the expired time increase from 0 to 2 seconds. At the end of this two second period, I want a second numeric indicator to start incrementing from 0 to 3 seconds. I am using a USB 9237 DAQ. Sampling frequency of 2k Hz, and samples read of 500. So far, here is what I have put together.
The first problem I have is that the first indicator does not start at 0, it starts at .25. The only data I care about is the data during the 3 seconds of "Full force". For this reason, I multiply my signal by 0 except for during the "Full force" period. The problem I am having is that I am not consistently getting 6000 samples. Sometimes I get 5500. If however, there isn't exactly 4000 frames before the "full force" data, then my average will be off. I only start to write to .tdms when the "Start Trial" button is pressed
Is there a better way for me to get this 2 seconds then 3 seconds time setup?
Any help will greatly be appreciated.
Regards,
Johan
09-15-2010 05:11 PM
JHendrik,
What version of LabVIEW are you using? What OS are you using?
I am running LabVIEW 2010 on Windows 7 and when I run your program the indicators start at 0 and not .25. That being the case, I changed your constant from 2.25 to 2 and it runs as one would expect 0-2 then immediatly 0-3.
Thoughts?
09-15-2010 08:09 PM
Hi,
I am running the student version of labview 2009, with Windows 7. When I run the timing setup by itself, it certainly does start at 0. When the timing setup is added in with the DAQ though, the "samples read" influences how the time is incremented. If I set the samples read at 1k, with a sampling frequency of 2k, then it increments in 0.5 second increments. If I set the samples read at 500, with a sampling frequency of 2k, then it increments in 0.25 seconds. I can kind of understand why the time increments in these intervals. But the fact that it doesn't start at 0, and that it doesnt increment in perfect intervals is a mystery to me.
Regards,
Johan
09-16-2010 12:14 PM
JHendrik,
That increments you are seeing are due to DAQ code for sure. If ou are sampling at 2khz and want 500 samples, then it'll take .25 seconds to retrieve those samples. While that retreive is happening, your other code may not execute (depending on data flow) becaue it's waiting for the DAQ samples to be returned. By your description, I would guess that the Elapsed time VI is being read after you get your samples, which would be why you don't start at 0 seconds. Try fixing your data flow so that the elapsed time is read first.
09-17-2010 11:00 AM
Hi,
Thank you for the help, it certainly makes sense, but I am not sure how I would go about that. I tried a loop within a loop, but it didn't work. Any other suggestions?
Regards,
Johan
09-17-2010 11:33 AM
Hi Everyone,
Thank you for all of your assistance, I managed to get around the problem. I really appreciate all the help.
Regards,
Johan