Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB 6008 AI acquisition and DO pulse genereation

Solved!
Go to solution

Dear LabVIEW users,

 

Greetings for everyone. I am a beginner of LabVIEW and I have a problem, which I have solved partially. I would really appreciate your help and suggestions as I searched for days without any luck. The problem is as following:

 

I am acquiring AI voltage (continous) from 4-8 accelerometers. At the same time, I am sending a digital output signal each time when the sample rate is clicked (i.e. 1000, 2000, 3000, .... if sampling rate is 1000). In other words, trying to send a digital output signal (at some frequency 'n' Hz) at regular 1 second interval (according to hardware level). So that the digital output signal will blink an LED at every one second. Further, I need to write the AI (voltage) signals, and LED blink PC (software) timestamps separately. All the above said steps are followed in my .vi program but the real hardware/software level operations are killing my timestamps. In other words each LED blink timestamps are not accurate when I use LabVIEW measurement file express VI (difference is not atleast to the third decimal place). In addition, the timestamping is somewhat OK when I disable the LVM file write VI. Onemore thing I noticed is that, physically LED blinks every two second once, I suspect this is due to the shift register and loop delay of second. Is there a way to control the blink speed (i.e. boolean state has to change at every 500ms without delaying the inner while loop).

 

Results and observations:

LabVIEW 2011 .vi, timestamp files with and without LVM file generator (express VI) are all attached. Please note that there is a considerable amount of drift in consecutive timestamps when LVM file generator is used, on the other hand there is 0.001 ms drift when LVM file generator is not used. The reason for PC timestamps are to roughtly align different measurements or observations or events in global time scale.

 

Please give me any suggestions or help me to make it atleast accurate for milliseconds within the witten VI. Lastly, is there any relatively inexpensive USB DAQ module which can send a pulse to directly from pulse channel to digital output channels when sample rate of 'n' Hz is achieved by hardware level which could be every accurate, so that software delay is fully minimized. Although there are highly sophistiated hardwares from NI, but our goal of this project is to build and test cost effective system.

 

Thank you and I really appreciate your inavluable time and effort. Have a great weekend!

With Regards,
Paghalaya
0 Kudos
Message 1 of 7
(6,921 Views)

Paghalaya,

 

Software timing when using a desktop operating system will never be precise to the millisecond level.  The USB-6008 has hardware timing only for the AI function. The DO is software timed.

 

To get precise 500 ms intevals for the DO, you will need to use a device with hardware timed digital outputs.

 

Some things which might improve your VI, although they will not solve all your problems:

1. Consider a parallel loop architecture (suche as Producer/Consumer). Moving the File writes to a separate loop from the data acquisition may reduce the timing jitter on the DO.

2. Acquire 500 samples twice per second rather than 1000 samples once per second.  That will allow you to get the DO timing closer to what you want.  It will not be perfect, but the hardware timing of the AI will help.

3. Dev1/ai0:3 (maybe Dev1/ai0:ai3) should get all four channels at once.  I do not have DAQmx so I am not sure of the syntax.

4. You have the Write to Measurement File Express VI set to overwrite the file.  Is that what you really want?

 

Lynn

0 Kudos
Message 2 of 7
(6,908 Views)

Lynn,

 

Thank you very much for your prompt reply, I really appreciate your time. As far as your solution steps to improve the code are concerned, I got 2, 3 and 4. In the fourth point, yes currently I am overwriting the file, but is that in anyway affect the speed of execution? Lastly, would you like to give some more insight on the first point as I am a little unfamiliar with the concept (its brand new for me). Any references are much appreciated.

 

Once again thank you! 

With Regards,
Paghalaya
0 Kudos
Message 3 of 7
(6,905 Views)

Paghalaya,

 

I do not have access to LV 8.0 any longer so I cannot be sure the template was available then. In LV 8.20 (the next newer version than yours) you can find a dialog like this by selecting New... (not New VI) from the FIle menu:

 

P_C template menu.png

 

The help files should give you some information about how it works.  There are many discussions on the LabVIEW Board of the Forums about Producer/Consumer although many of them will have examples in newer versions of LV.

 

Lynn

 

0 Kudos
Message 4 of 7
(6,891 Views)

Dear Lynn,

 

Thank you, sure I will try this. By the way, sorry if I am repeating this, you mentioned about acquiring 500 samples twice per second rather than 1000 samples once per second. Eventually, is there a way to do that, when I checked with that I didn;t found anything, further I am a bit confused with making that. Any help or suggestions are much appreciated.

 

Thanks again,

With Regards,
Paghalaya
0 Kudos
Message 5 of 7
(6,873 Views)
Solution
Accepted by topic author Paghalaya

Just change the Samples to Read constant at the input to the DAQmx Read.vi from 1000 to 500.

 

Lynn

0 Kudos
Message 6 of 7
(6,871 Views)

Thanks Lynn, it worked but I made it 2000 samples/sec! 500 samples gave a 4 second delay! Now I will work on data write and post if I am successful or not.

 

Thanks again,

With Regards,
Paghalaya
0 Kudos
Message 7 of 7
(6,868 Views)