How to count TTL pulses during 100ms ?

I need to count TTL pulses coming out of an instrument (particule
counter). The pulses appear randomly. I must count how many pulses
appeared in the last 100ms, and so on, every 100ms. I don't want
cumulative counts, but the number of events every 100ms.
I need a hardware clock, so that the counting pace cannot be disturbed
by Windows making some weird, unrequested, CPU-hungry task.
I fact, I need to do that for 2 identical instruments of the same kind,
and I have 2 cards with 2 counters each, total 4 counters. My idea
would be to use 1 counter as the clock for 2 other counters, but how to
trigger the counter value read ?
Thanks.

Hi,
In the example I gave you, you need to supply the TTL you want to count the pulse (connected on pin 37) and a TTL "clock"  which is connected to PFI0. The TTL on PFI0 permits a hardware timing (100ms for example) to count the edges that occur on the TTL source.
If you do not need hardware timing, have a look at the example attached. You only have to connect the TTL source and the VI counts every 100ms (software timed) the edges that occur durind those 100 ms.
Hope it will help you,
Regards,
David D.
Application Engineer - NI France
01-02-2006 01:26 PM
Attachments:
Compatge des fronts toutes les 100 ms.vi ‏61 KB

Similar Messages

  • How to count TTL pulse by DAQ through BNC 2090?

    I'm trying to count the TTL pulse from a APD by DAQ. There are some very nice discussions about this issue in this board. However, I am a novice and not sure about the hardware connection. The signal from APD is delievered out through a BNC cable and I'm trying to deliever this signal to DAQ through BNC 2090. I tried just simply connect the BNC cable to ACH0 and tried running the vi's, such as "Count_Edges.vi" and "Count_Events.vi". But I got no counts. I noticed that both these vis are actually reading signal from PFI port. That could explain why I got not counts.
    So now the problem is how should I connect my signal in a BNC cable to the DAQ and have the counting working? Thank you for your help.

    Hi Opal,
    Here is what you should do for the hardware connections with these devices:
    - connect your external signal to the BNC-2090
    - connect the 68 pin connector on the BNC-2090 to the 68 pin connector on your DAQ board. You should have a 68 to 68 pin cable for this.
    That is all that is involved with the hardware connections. After this, you should be able to read your signal. Here is the link to a helpful DAQ manual with in depth getting started information: DAQ Getting Started Guide. I hope that you find this information helfpul.
    Regards,
    Hal L.

  • Counting TTL pulses from 10 Hz to 3000000Hz with LAB-PC-1200

    I want to count TTL pulses from an electron analyser. How can I use the DAQ wizard to connect the analyser to the PC-1200 and look if it works?

    Augerspectro,
    The counter chip used on the Lab-PC-1200 is the 8253. Thus, you will be able to use any of the 8253-counter examples available in LabVIEW. To count pulses, I would suggest that you examine the Count Events (8253).vi example. With regards to the required hardware connection, this is discussed in the device's user manual (link available below).
    Lab-PC-1200/AI User Manual
    Good luck with your application.
    Spencer S.

  • How to count digital pulses?

    I am using usb-6501 to read in 12 distinct digital pulses and want to know how to count the pulses. The 6501 has only one counter channel so I am looking for a software/labview program option to count pulses for each channel individually. 

    Do you need to know when they change or just how many times they changed? Also how fast are they changing?
    Mike ...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Counting TTL pulses within specified integration time

    Dear all,
    I have a PCI-6014 board, and I use Labview 7.1 and would like to do the following task with DAQmx7.4:
    Analog source:  analog square wave (or = 1Hz TTL pulses) produced by a function generator
    Signal: photon signals from a photomultiplier (random TTL pulses)
    I would like to count the photon signals at 100ms integration time, repetitively. But I don't want cumulative counts, just the number of photons (TTL pulses)  in every 100ms.  I would also like to make sure that I synchronize the counter with the analog source, i.e. to make sure I get exactly 10 data points in each analog cycle. ( I can't use the computer to start the function generator and it just keeps running., so I want to make sure I start counting on the starting edge of the analog wave.)
    I used to do this with the traditional DAQ and connected the analog source to the "GATE" pin of the counter , so i could count "while gate is high" ( or while gate low, or count on rising edge/ falling edge. ) However I found some problems and I think my counter wasn't counting correctly, and I would like to rewrite the task  with DAQmx anyway.  Ideally I would like to separate the signals that occur in the first 1/2 and the second 1/2 of each analog cycle. But if that is not quite achievable, I can do the separation later when I process the data, provided that I know each 10 data points from the counter correspond to each analog cycle.
    I have read several threads on the discussion board, but I still couldn't configure my applications using those examples.
    Also I wonder if the "Arm Start Trigger" function is not available on my PCI-6014 card ? Because I can not find it in the Start Trigger property node.
    Thank you very much for your reply. Any hint or advice would be greatly appreciated.
    Joyce

    ...(Continued from prev post due to 500-char limit)
    Now, here's a proposal for a method that should be able to work, though it'll require more data and more processing.  One key area to watch out for under DAQmx is the property node for "Duplicate Count Prevention."  The behavior changed between 7.1 and 7.3 (on E and/or M series, but not on TIO-based counters), then the defaults changed in 7.4, and something changed yet again in 7.5
    Bottom line: you can set it to True or False.  One setting will allow you to buffer up 0 values for intervals where there are no Source signals (photon events) within a sampling period (10 Hz hw clock).  The other setting will not record anything in the buffer for those intervals.  Clearly, you need the former setting, so you can always experiment to see how it behaves.  I kinda gave up on trying to interpret it, understand it, or keep up with the differences by DAQmx version and DAQ board.
    Ok, here goes:  I'm going to propose that you actually oversample by about 10x and that you capture the Analog square wave in sync with your photon counts.  Then your post-processing can determine for sure which samples correspond to Analog Square High and which to Low.  You'll also be able to adjust for times when you get 1 too many or one too few samples in a square wave cycle, due to having independent un-sync'ed timebases.
    So on one counter you generate a 100 Hz clock.  The other one is programmed for buffered period measurement using the 100 Hz clock as a SampleClock and the photon pulses as the Source signal (this must be set up using a DAQmx Channel property node I believe).  Remeber to be careful also about the DuplicateCountPrevention property.
    You would further setup an AI task using the same 100 Hz clock as a Sample clock.  Be sure that the 100 Hz clock task is started after starting both the other tasks.  Also, be sure to always read the same # of samples from both tasks to keep the counter period and AI data in sync.
    Voila!  You now generate a data record of # of photon pulses for each 10 msec interval along with the voltage of the analog square wave at the end of that interval.  A bit of post-processing and you're covered.  If you're not required to manipulate data while the acq tasks are running, you can surely afford to bump up the oversampling rate considerably.  The main advantage is to gain resolution on the time of transition of the analog square wave.  For any interval ending with a TTL state change, you won't know where within that interval the transition occurred.
    -Kevin P.

  • Counting TTL pulses at high speed

    Hi all,
    I am using PCI-6221 board with DAQmx to count the number of TTL pulses (which varies in its frequency between 0Hz to 10MHz) at a high speed (200,000 samples/sec.) and I am having a problem when the TTL pulse frequency drops below a certain level.
    I am using CTR0 to generate continuous pulse train at 200kHz frequency to feed to CTR1 Gate input. I verified that the pulse train is being generated fine.
    I am using CRT1 with buffered counting to collect the count for 200,000 samples at a time (duration of 1 sec.). I got the example code (Cnt-Buf-Cont-ExtClk) and pretty much used it as is.
    CTR1 Gate is coming from CTR0 Out, which is 200kHz pulse train with 50% duty cycle, and CTR1 Source is the TTL signal that I am trying to count. At first, I thought that everything was working fine with the Source signal being at around 5MHz. Then, when I had the Source signal down below about 300kHz, I noticed that the program is taking longer than 1 sec. to collect the same 200k samples. Then, when I got the Source signal down to 0Hz, the program timed out.
    I am guessing that somehow the counter is not reading for the next sample when there has been no change to the count, but I cannot figure out why and how.
    Any information on this and a way to get around would be greatly appreciated.
    Kwang

    One thing you can try is to set the counter input CI.DupCounterPrevention property, this setting will filter the input, it is possible that when the ctr 0 is slow then many of the values you are counting become zero as well and are filtered out, since they are nolonger points, the counter will not collect enough points before the time-out occurs and the counter input read times out.  I am not sure if this is your issue but I found out the hard way that this occurs when I switched to daqMX where this feature was added.  Let me know if it worked,
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Counting TTL pulses from A between TTL pulses from B

    I have two sources of TTL pulses. I need to count, from a c/c++ script, how many TTL pulses are received from source A between each of the  TTL pulses received from source B.
    I have a PCI-6229 connected to a BNC 2090A, and both of my TTL pulses sources are connected via BNC plugs.
    Is there any function that can do that?
    I tried to get an example script using the DAQ assistant from LabWindows, selecting acquire signals -> counter input -> Edge count. The function that I got as a result was DAQmxCreateCICountEdgesChan, and I am afraid that it only takes the counter as an argument and not the second digital input that marks the intervals.

    From your description it seems to me that the best option is to use two-edge separation measurement. I am not on a PC with CVI installed so I cannot point you to a specific example but this tutorial gives you a brief explanation and some guidance on examples to look at.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Counting ttl pulses

    Hello Everyone,
    I am attempting to continuously record (i.e. time stamp) only positive (i.e. 'Logic High' event) TTL pulses from a PMT using a PCI-6602 board via a BNC-2121.
    From reading the LabVIEW tutorials/examples it seems that I should be able to get very high precision (15 digits) from the "Get Date/Time In Seconds" VI. I need to be able to record times to the microsecond (at least). Yet when I look at the data it appears that for every digit less than a millisecond either a 9 or a 0 is recorded, which leads me to believe that I can't get better time resolution than a millisecond. Is there anything I can do to change this?
    Assuming that I can get this to work I would also like to simultaneously monitor and record a second PMT channel. Any hints or tips would be great!
    I've attached my very basic VI below.
    Cheers,
    CJ
    Message Edited by CJKS on 05-22-2006 11:53 AM
    Attachments:
    PMTcounter.vi ‏126 KB

    Yes the simpliest way to do what you want is to count the time between rising edges using a counter (the 6602 has 8 80 Mhz 32-bit counters).  Yo will not use digital io but time counting.  The gate of your counter will be the TTL/Cmos pulse from your PMT and the source of the counter will be the 6602 master clock 80Mhz, so you can count clock ticks between photons, now you have a 12.5ns time resolution.  You can use the system clock to get a time zero if you would like to use absolute time.  The olny thing to keep in mind is that you will be limited to a maximum time between pulses of 2^32/80M or 53 seconds, you will get an overflow of your counter but usually this is not a problem with photon counting.  You will be also limited to a maximum photon rate of about 20Mphoton events.sec this is also not a problem since the interesting photon events seem to happen between these time scales.  if you want a longer time scale you cvan always casceds 2 counters to get 64bit resolution but this is probablu not necessary.  Look at the buffered period measurment examples.  You can easily scale this to 8 counters with 8 PMTs if desired with your curent hardware but this gets expensive.  Goodluck.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Count ttl pulse only over 2 V

    Hi I have a problem while I was trying to count a ttl pulse by using the DAQ Assistant. The problem may be simple but I just cannot solve that since I am new to LabView.
    There is a TTL pulse generated from our APD which is about 30 ns width, 5V. I want to use LabView to do the photon counting. However due to the noise, I would like to set a count limit of 2V, so the software only count the TTL pulse which is greater than 2V. But I cannot do that. There is no option to set the limit.
    And our hardware is BNC-2110 and PCIe-6323.
    Can someone help me with this? Thanks.
    Solved!
    Go to Solution.

    Okay so perform a finite or continous read of your analog input.  Then you can perform a threshold, where all values below 2 become 0.  This can be done many ways but I'd suggest an auto indexing for loop and using a select function in the for loop.  Then you can perform any normal edge detection you normally would to count pulses.
    EDIT: Post some code if you can.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to count the pulses of an incrementa​l encoder with PCI-6010?

    Hi everyone,
    I am trying to use an incremental encoder and PCI-6010 card to measure the speed of a rotary shaft in Labview 2011. I need to use the counter to count the numbers of the pulses that the encoder generates but I have some problems there to do so.
    I connected the encoder signal to the counter source (PFI0) and built a daq assistant block in the Labview (Acquire signals -> Counter Input -> Edge Count -> ctr0) and it is set as shown in the figure. The problem is that no matter how I turn the shaft the measured value will always be 0 although the pulses can be seen very clearly on the O-scope. 
    I suppose I must have made a very simple mistake. Could anyone help me on that please?
    Thank you.

    Hi YShZh,
    The current Acquisition Mode setting is set to "1 Sample (On Demand)" and will therefore only ever give you the first count value.  The fist count value is equal to the initial count value, which in your case is 0.
    Try changing the acquisition mode to either N Samples or Continuous Samples.
    Kind regards,
    Marshall B
    Applications Engineer
    National Instruments UK & Ireland

  • Counting TTL pulses using USB 6008

    Hi Folks,
    I am trying to setup a performance monitoring VI for a manufacturing line.
    I am going to use a sensor at the end of the line to count the number/rate of boxes that come of the line and perform a calculation to give us the productivity.
    The problem I have is that I would like to be able to scroll back over time to view historical productivity. Also I would like to be able to insert reason codes for downtime and print off a report at the end of the week showing a productivity graph and downtime associated with the line.
    I am new to Labview and I am not sure if this can be done, any help would be appreciated.
    Thanks
    Tony.
    Attachments:
    K2 Productivity-s.vi ‏60 KB

    Search 'count'.  Count Digital Events.vi is the most basic one of interest.
    Of course you won't find an example of counting pulses, analyzing the data and creating a report.  You'll have to put all the pieces together yourself.  This is just a start.  The good news is that LabVIEW is designed to do just the type of thing you're needing and your app will be quite simple to contrive once you get the hang of LabVIEW.  I suggest going through the many tutorials to get the basics down before you try to architect your program.
    Using LabVIEW: 7.1.1, 8.5.1 & 2013

  • Inputing TTL pulses to NI-PCI-MIO​-16E-1 via BNC-2110

    I need to count TTL pulses coming from photomultiplying tube (PMT) module. Can someone tell me, please, how do I connect BNC cable from PMT module to NI PCI-MIO 16E-1 DAQ board via BNC-2110 adapter?
    thanks a lot in advance

    Hello Photon Guy,
    Thank you for contacting National Instruments.
    I have attached an image which shows how to connect the USER 1 BNC and USER 2 BNC connectors to the proper PFI pins which serve as the source of counter 0 and counter 1. You should only need to use one counter to count edges.
    Regards,
    Bill B
    Applications Engineer
    National Instruments
    Attachments:
    BNC-2110.JPG ‏105 KB

  • How to use counter output pulses to trigger analog input?

    Hello all,
    I hope the kind people using this forum can help me, a lowly beginner LV programmer! I have been attempting to create a VI that produces a user defined number of TTL pulses, separated by every n seconds. Each TTL would be outputted to a stimulator, which in turn generates its own TTL. Using the stimulator-generated TTL, I would like to trigger finite analog data acquisition (e.g. for every TTL, trigger the collection of a data sweep that contains 4000 samples (collected at 4000 Hz), with 1000 samples collected pre-trigger. I would like to also be able to see each data sweep as it is triggered on a chart. As I understand things (lots of online/book/forum reading), I should be using the counter output to generate my TTL pulses, and syncing each counter produced TTL with analog input, as well as using a reference trigger. Also, the AI part should be started first, so that I don' t miss any counter outputs. If it matters, I also need to use one of the AI channels to acquire the TTL, so I can see my stimulator-induced responses to the stimulator in time.
    I am able to generate the TTL pulses from the counter output, but I am having a problem with the AI part. I am unsure how to sync the counter output with AI. Also, since I need to acquire pre-trigger samples, I would be needing to acquire samples continuously, but when I set 'continuous samples' on daqmx timing, the VI doesn't work (hence why's its set to 'finite samples').
     I hope someone out there can help, as I have been at this for what seems ages, with limited success. I am using a USB-6259 and LabView v8.2. Thanks!
    Attachments:
    RC001 v_1.vi ‏49 KB

    Hello,
    Due to the fact that analog tasks themselves are not retriggerable, a
    pulse train produced by a counter is always used as the sample clock
    for the analog input task in order to recreate a retriggerable effect
    for analog input. This can be done by creating a finite pulse train set
    to retriggerable using the DAQmx Trigger Property Node, or the pulse
    train could be continuous and just be gated by another signal. Neither
    of these methods can be properly applied in hardware to create a
    retriggerable reference trigger. You can however implement something
    similar in software by just stopping and restarting your reference
    triggered analog input task within a loop. There will be some delay
    between when the task is stopped and restarted, as these events require
    software intervention, but if there is enough time between when each
    trigger signal is generated, there should not be any noticeable delay
    or missed samples.
    I have attached an example of this!
    Mark B
    ===If this fixes your problem, mark as solution!===
    Attachments:
    RC001 v_1mod.vi ‏25 KB

  • How to measure the pulse duration of a TTL signal using AI?

    Hi there.
    I would like to know how to measure the pulse duration of a TTL signal using an Analog input.
    These TTL signals comes from an ultrasonic sensor's output. The pulse width of the signal is
    proportional to the distance of the object the sensor detected.
    I have tried using the example "Measure Pulse Width.vi" which uses a counter to measure the
    pulse duration instead. It provides me with correct results.
    However, i will like to know how can i do it using the AI instead.
    I tried it by using the example "Acq&Graph Voltage-Int Clk.vi" which i modified by including a
    timing and transistion measurement vi. Pulse duration was selected as the output. A graph indicator was also added at the output of the pulse duration to monitor the incoming TTL signals.
    However, everytime the TTL signals was detected on the graph indicator, the numeric indicator always produce a "zero" reading.
    I have attached my vi for your reference.
    Can anybody advice me what i have done wrongly?
    Regard.
    Attachments:
    Acq&Graph Voltage-Int Clkv1.vi ‏190 KB

    Hi Paul,
    Today i tried using 2 different methods to read the pulse duration of my sensor signal.
    Both methods use "Acq&Graph Voltage-IntClk" vi as a guide.
    Method1:
    Add a filter vi(lowpass/bandpass) and a timing and transition measurements vi.
    Pulse duration is selected as the output. With some numeric conversion, a centimeter
    reading indicator was created. However, the reading always remains as "zero"
    Method2:
    Add a Mask and Limit Testing vi and a timing and transition measurements vi.
    By adjusting my upper and lower limits, i manage to "filter" a single pulse out from the actual signal.
    However, like the earlier case, the cm reading still remains at "zero"
    I have attached both the methods resulted waveforms for your reference.
    Are there anything that you can advice on?
    Regard.
    Attachments:
    Results_Waveforms.doc ‏141 KB

  • How to generate pulse during changing boolean value?

    I need to generate short pulse during changing boolean value from 0 to 1. This pulse is needed to reset counter. 
    I was trying with Event Structure with Value Change but I think that I did something wrong.
    Maybe sambody can give me some tips to do it in other way?
    Thank you in advance.
    Regards
    Solved!
    Go to Solution.

    Rogal wrote:
    I need to generate short pulse during changing boolean value from 0 to 1. This pulse is needed to reset counter. 
    I was trying with Event Structure with Value Change but I think that I did something wrong.
    Maybe sambody can give me some tips to do it in other way?
    Thank you in advance.
    Regards
    We assumed you wanted a pulse when a front panel button (boolean) was clicked.
    I am still not sure just what it is you want.
    Do you want a single pulse when x is greater than 4?
    You don't need an event structure for that.
    Omar

Maybe you are looking for