From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting TTL pulses in LabVIEW

Hey guys,

I'm a poor little undergrad who has been given LabVIEW, a PCI-6220 card and a BNC-2110 breakout box and told to count the TTL pulses from an avalanche photo diode (at up to 40 MHz).

I've managed to get LabVIEW reading analog inputs with no problems but I've spent days trying to get the counter working.

Measurement & Automation > My System > Devices and Interfaces > NI-DAQmx Devices > NI PCI-6220: "Dev1" > Test panels... > Counter I/O
will happily give me the edge count of a signal from an external generator.
(Settings as follows: "Channel Name" = "Dev1/ctr0", "Mode" = "Edge Counting", "Edge Source" = "/Dev1/PFI1", Frequency" = 1000, "Duty Cycle" = "50"  Physical ground from signal generator connected to "D GND" and the signal wire to "PFI 1")

I tried using
C:\Program Files\National Instruments\LabVIEW 8.0\examples\DAQmx\Counter\Count Digital Events.llb\Count Digital Events-Buffered-Continuous-Ext Clk.vi
But it just kept giving errors. Either it didn't find a signal when using /Dev1/PFI* (error -200284 "Some or all of the samples requested have not yet been acquired...") or if I tried other sources like OnboardClock (Error -200303 "External sample clock must be specified for this application) I got a selection of other errors.

Any help would be very gratefully received.

Thanks,

Robert

0 Kudos
Message 1 of 7
(4,785 Views)
Did you try using 'count digital events.vi' ??
 
Try it
 
0 Kudos
Message 2 of 7
(4,769 Views)
Hey,

I tried the one you said and I got it working after changing the input in the subvi "create channel" then trying all the PFI inputs on the breakout block!

Thank you so much for your help.

It still doesn't seem to want to work with the "count digital events-buffered-continuous Ext Clk.vi" and I don't know why. However that doesn't matter any more as all I need is that pulsed input counted.
0 Kudos
Message 3 of 7
(4,765 Views)
Do read throught the doucmentation for that VI
 
It tells
Note: For buffered event counting, an external sample clock is necessary to signal when a sample should be inserted into the buffer.  This is set by the Sample Clock Source control.

So you to Physically Hardwire/connect an external Sample clock for this VI to work

Hope this helps


 
0 Kudos
Message 4 of 7
(4,763 Views)
Thanks again for your help.
 
I think ideally we would have a stable hardware clock and switch to "count digital events-buffered-continuous Ext Clk.vi" but we don't appear to have one lying around.
0 Kudos
Message 5 of 7
(4,728 Views)

could you send me a copy of your vi for the counting? I try to use the count digital events but still not able to make it. Thanks a lot~

0 Kudos
Message 6 of 7
(3,631 Views)

@shengwang16 wrote:

could you send me a copy of your vi for the counting? I try to use the count digital events but still not able to make it. Thanks a lot~


This is 9 year old thread and the participants have not visited in many years. You probably should start with a new thread.

0 Kudos
Message 7 of 7
(3,597 Views)