Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

event counter using USB-6210 analog

Hi,

 

Any suggestions or directions where to look to generate a VI that would record event from a magnetic counter of a mouse wheel. I would like to record up to 16 wheels using the USB-6210 device. Thanks!

 

VO2max

0 Kudos
Message 1 of 4
(4,571 Views)

Hi VO2max,

 

Welcome to the NI forums!  The DAQmx examples can be found in the LabVIEW Example Finder under:

 

Help » Find Examples... » Hardware Input and Output » DAQmx

 

The examples should be a good place to start.  What type of measurement do you need to make?  If you're using all 16 analog input channels on the 6210, this would result in a sample rate between 15kHz and 16kHz per channel.  The Cont Acq&Graph Voltage-Int Clk.vi example would be a good starting point if this is what you are trying to do.

 

More information about your setup would be helpful.  For instance, how do you have the signal connected to the 6210?  Do you need to plot an analog graph of the signal, count edges, or do something else?  What are the characteristics of the signal you are trying to measure (i.e. frequency, amplitude, shape).  Do you have any specific questions or concerns?  If so, please let me know and I will be happy to provide an answer.  Thanks for posting!

 

-John 

John Passiak
Message 2 of 4
(4,560 Views)

Hi John,

 

Thanks for the reply! Correction, I am using 8 of the analog inputs on the USB-6210.  I am trying to set up a program to read 8 analog inputs from 8 mouse wheels. Each of the mouse wheels will have a magnetic counter (one (+) and one (-) wire coming from each wheel) to note rotations of the wheel, so that I can determine how much and how long the mice are running at night for our voluntary-wheel running experiment. In essence I am trying to write a simple VI to note the number of rotations (i.e., event counter) using the USB-6210 as the interface between the magnetic counters and LabView. I did some searches but it appears the USB-6210 cannot be a "counter" input, is that correct? Also I would like the VI to write the data to a file, but only write the data when the mice are actually running to reduce the size of the file; this could be done by? Thanks!

 

VO2max

0 Kudos
Message 3 of 4
(4,556 Views)

Thanks for the extra information.

 

The 6210 actually has two counters, so you could count the edges (on two of the wheels) if the signals are TTL compatible.  You can use the Count Digital Events.vi example to help you get started.  From LabVIEW, it can be found at:

 

Help » Find Examples... » Hardware Input and Output » DAQmx » Counter Measurements » Count Digital Events

  

If your signals are TTL compatible, I would highly recommend purchasing a PCI-6602 and using this method for all 8 channels.  You could modify the example code by increasing the delay (software-timed sample rate) to a larger value (say 1 minute), and logging the results to a file as you run.  Doing this would log the value of the event counter every minute, and would keep the file size relatively small (about 15kB if you run for 8 hours).

 

If you must use a single 6210 and require all 8 channels, the only option would be to use continuous analog inputs.  You would have to sample at a high enough rate to not skip the pulses (I am not sure what that is without knowing more about the signal), and then process the digitized signal in software to determine the information that you need.  I would use the Producer/Consumer design template in conjunction with a continuous analog input example to get started.  In the consumer loop, you would have to implement the functionality of the counter in software.

 

Using a hardware counter would be preferrable to using analog inputs.  The counter is made for exactly this type of task, and implementing it in software can be complicated as well as processor intensive.  If you have any questions let me know, I'm happy to help you out.  You can always try out the counter task on the 6210 for two wheels to see how it will work before deciding whether or not to purchase a new board.

 

-John 

 

P.S. After your first post I had assumed that you were testing computer peripherals, but it looks like you actually have eight rodents.  We had a good laugh over here over my confusion.

 

John Passiak
Message 4 of 4
(4,541 Views)