Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

digital acquisition with a freq of 1ms with a usb6009

Hello
I need to determine the time between the triggers of two switches. I am using a USB 6009. How can I build the application in order to have a high acquisition rate. The time distance should be around 10 ms.
Many thanks
 
0 Kudos
Message 1 of 7
(3,566 Views)
If I were you, I would feed the first switch into the PFI0 input of the device and set up a task to sample the other switch for 20 ms (at 48 kS/s that would be about 1000 points).  This task should be set up to be triggered by the PFI0 input.  The time difference would be the edge generated by the second switch to the beginning of the acquisition.  Depending on what the signal is, you will have to decide whether to use an analog or digital input for your task.



Randall Pursley
0 Kudos
Message 2 of 7
(3,556 Views)

Thank you Randall

sounds like a good idea but the problem is that I don't know which of them will triger first. Eventually I will use 7 switches and I need to find out the order of triggering and the time between them. I also have a CompactRio but I thought that with the usb device I will speed the things up. Now I'll have to figure out how to design the application for the cRIO.

Any advice will help

regards

 

0 Kudos
Message 3 of 7
(3,551 Views)
Well, then you will have to add a little external circuitry to OR the signals together before connecting it to the PFI0 input.  If they are digital signals, then an OR gate will be fine.  If they are analog or digital then pass each through a diode and then connect the cathodes together before connecting to the PFI0 input.  I think you may need a resistor to ground at PFI0 too.  This will generate an edge regardless which is first.

Then you have to do the same acquisition as before but with all of the switch outputs (before the diodes) connected to inputs.



The only other way I can think of is to constantly acquire all of the channels at lets say at 100 ms intervals (at 48 kS/s that would be 4800 points/channel) and throw out the data until some is acquired that have voltages above a threshold (you would have to do this in software) and then keep that set and the next, then concatenate them together and do the analysis.

Randall Pursley
0 Kudos
Message 4 of 7
(3,547 Views)

Hi Mugur,

I can think of three ways to approach your problem.  The most accurate and reliable approach would be to use your compactRIO with a digital input module. This approach can be a little complicated unless you are already familiar with FPGA programming and its timing concepts. The second most accurate way would be to use analog input with hardware timing with your USB-6009. This approach would be similar to Randall's suggestion. Both of these ways are ensured to meet your 1 kHz sample rate (1 ms period) requirement.

The least accurate way is to use digital input on your USB-6009. This is because the USB-6009 cannot do hardware-timed digital input. However, I made an example of doing it this way just because it was simple to code up and I was interested in finding out how fast I could do software-timed digital input on USB DAQ devices. My code samples seven digital channels and whenever a channel goes low (switch triggered) it makes a timestamp and remembers the index of the channel. You can easily get the time difference between triggered switches by comparing the timestamps.

I tried my code on a USB-6008, and I could get slightly less than a 1 kHz sample rate (about 900+ Hz). This might not be sampling fast enough for you but maybe my code can give you some ideas about how to implement the other approaches.

Let me know if you have any questions about my code or if you need any more help.

Way S.

NI UK Applications Engineer 

0 Kudos
Message 5 of 7
(3,531 Views)
Hi TheWay
 
many thanks for your effort. My only problem is that I'm using LV8 and I can't see your application. I was thinking of using a timed loop but i never thought of timestamp. I would appreciate if you convert the application for my LV version. Anyhow, I will have to build the cRio application too, but that will take a while :)...
 
Regards
0 Kudos
Message 6 of 7
(3,527 Views)
Here is the VI saved in LV 8.0.  Hopefully, my VI can give you some ideas about building your cRIO application.
 
Regards
 
Way S.
 
0 Kudos
Message 7 of 7
(3,522 Views)