Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring frequency of non-TTL pulse train with counters on 6052e

I have a pulse train that is nearly TTL but not quite and I'd like to measure it's frequency. At the higher frequencies (~4k, pulse width ~22 us) I've been successful using the "Meas Dig Frequency-Low Freq 1 Ctr.vi" example, but as the frequency decreases and pulse width increases, I get more spurious measurements which look like it's counting multiple rising edges on a single pulse. Since the pulse doesn't look exactly square - it's got a fast rise time up to 3.5V which then slowly rises to 4.5V, and something similar for the falling edge - I'd like to try using the analog circuitry of the 6052e to create a more TTL compatible signal. I've found a somewhat helpful description here of how to do this, but I'm uncertain how to merge this with the counter frequency measurement example and how to feed the digital signal from the analog trigger into the input of the counter. Any suggestions?

 

-Ryan 

0 Kudos
Message 1 of 5
(6,851 Views)

Hello,

 

From the information you provided/knowledgebase included in the original post, the Schmitt Trigger appears to be the most plausible option. An additional recommendation would be implementing a digital filter using an M series or X series card. Digital debounce filters can be enabled on the Programmable Function Input (PFI) lines, and the user can specify a minimum digital pulse width of e.g. 0s, 2.56ms, 6.425us and 125ns (M Series) which would accomodate for the spurious measurements during these specified durations. For more information on these cards/digital filters, please refere to the following link:

 

1. Digital Filtering with M Series and CompactDAQ: http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/9ece7dbe7df338bd86256f8600734a41?O...

 

Best regards

 

Ali M

Applications Engineer

National Instruments

Message Edited by Ali M on 06-01-2010 07:05 PM
0 Kudos
Message 2 of 5
(6,805 Views)

Hi Ryan,

 

Although the 6052e does not have digital filtering like our newer Multifunction DAQ boards, it does have Analog Triggering circuitry.  By configuring an analog trigger (must be part of an AI task), a signal is created called the Analog Comparison Event. You would probably be intersted in an Analog Edge Start trigger with hysteresis configured to give you something like this:

2010-06-01_195720.png

 

In this case, the comparison event is not lowered until the device falls below the Level minus the Hysteresis.  So, if there is noise on the input line you don't have to worry about picking up multiple edges (unless the noise is enough to oscillate between Level and Level - Hysteresis).  

 

To set up the analog trigger, I would look at the DAQmx Shipping Example in the Example Finder called "Acq&Graph Voltage-Int Clk-Analog Start w Hyst.vi".  You'll want to make this into a continuous task so the trigger remains configured.  Even if the task has already been triggered, the Analog Comparison Event will continue to have the result of the on-board comparator.

 

 

There are a number of places you can route the Analog Comparison Event to:

 

 

2010-06-01_195435.png

 

 

For your application, you'll need to route it to the Gate of your counter.  In DAQmx, this just means to specify to use the Analog Comparison Event as the source for your frequency measurement.  I'm not at a computer with LV at the moment, but there is a DAQmx Channel Property Node that should let you configure this--let us know if you need help finding it.

 

 

 

Best Regards,

 

 

 

 

John Passiak
0 Kudos
Message 3 of 5
(6,799 Views)

Hi John,

 

Thanks for the  information. I think I've found the Property node you mention. I've merged the analog trigger configuration with a counter frequency measurement as shown:

analogtrigger_counter1.JPG

 

Is this what you were talking about when you suggested routing the Analog Comparison Event to the counter gate? I've attached my signal to the PFI0/AI Start Trigger input but unfortunately it is timing out at the DAQmx read for the counter frequency measurement. I can see the signal if I connect it to one of the analog inputs, and I can even use it as a digital trigger, so I think the problem may be with the on-board analog triggering circuitry. Is their any way to check the analog triggering to make sure it is functioning properly?

 

Alternatively is there another way to improve the frequency measurement with counters so I don't get so many spurious measurements (where, for the low frequency-single counter configuration, it apparently only sees 0, 1, or 2 rising edges of the 20MHz counter clock between edges of my signal)?

0 Kudos
Message 4 of 5
(6,778 Views)

Hi Ryan,

 

I notice you're reading back an array of samples--if you want to do this I would suggest to use the DAQmx Configure Implicit Timing VI on your counter task.  This will latch in the frequency (1/period) after the completion of every period of your input signal.

2010-06-02_144452.png

 

Other than that, it seems like this should work depending on what you have set for High level, Low level, and number of samples per channel.

-I would start by setting High level at 2.4V and Low level at .8 (TTL voltage levels)

 

-After configuring Implicit Timing, make sure that (number of samples per channel) / (the rate of your input signal) will be less than the timeout value (in seconds).

 

To validate the triggering circuitry is working in general, you can try just running the analog input shipping examples that use analog triggering.

 

 

There isn't really any other option using only the 6052E.  Our M Series and X Series DAQ boards allow the use of digital filtering which could be used to reject high and low pulses below a certain width. 

 

 

You could implement either option discussed (Schmitt Trigger or Digital Filter) using external circuitry, but I do think that the Analog Triggering circuitry on your board should be up to the task.  If you post the VI with default values set I can take a look and try to run it on an E Series over here.

 

 

Best Regards,

 

John Passiak
0 Kudos
Message 5 of 5
(6,770 Views)