Counting Pulses

my  aim is toimplement position control of DC motor,i am using NI USB 6221,to find the position i am using  IR LED  and Photodtector and an encoder wheel ,in which when light is received it counts as one and if not zero,is it possible for me to count the number of pulses and find the position,ihave only the above hardware resources,plese help me
my position Encoder resolution: 5.44mm / pulse.

Hi,
Use Counter logic to implement above. You will be able to find examples under "Drive:\Program Files\National Instruments\LabVIEW 2010\examples\DAQmx\Counter". Go through the relevant examples and you will get answer.  
Sriram Iyer

Similar Messages

  • Generate a delayed counter pulse

    I am posting this to see if anyone can shed any light on various DAQmx operations with counters.  I appear to have found a solution for the project but various counter operations are certainly not well documented and the notes I am posting may help anyone trying to do something similar.
    The project is to monitor an analog input channel and when a certain criterion is met generate a pulse with a specified width at a specified delay from the event.  It is being done in a LV Real Time system.  Initially I tried to start a counter task within a loop, wait until done and stop the task.  What I have found is that it takes a long time (of the order of 10-100's of ms) for the start task to return and the wait until done doesn't reliably return at the time the counter pulse is finished being generated.  Other people seem to have found the same problem.  This is described in the part 1 attachment and the attached vi.
    The other way to do it is with a retriggerable counter task and using a digital line on the same card to trigger the counter.  Then the way the counter works if there is a single pulse or multiple pulses is different.  The way low time and high time are interpreted is odd.    This is described in the part 2 attachment with screenshots from Scope captures.  I have a proposed solution but I'm not sure if it is the best way to do it.
    Any suggestions appreciated.
    Attachments:
    Generate delayed Counter Pulse problem part 2.doc ‏108 KB
    Generate delayed Counter Pulse Problem part 1.doc ‏25 KB
    Generate Counter Pulse.vi ‏153 KB

    Andrew,
    If you want to start a counter output task based on an analog input you should use an analog trigger (if your device supports analog triggering). Take a look at the example Cont Acq Sample-Timed Loop-Analog Start.vi (in the example finder - search for "trigger") for how to set up an analog trigger in DAQmx. Also, you can use the Start.Delay property in the DAQmx Trigger property node to specify an amount of time to wait after the Start Trigger is received before generating the first sample
    Michael P
    National Instruments

  • How do I get the 1121 card to read the switch and make it a 1 or 0 to count pulses?

    Hello,
    I am developing a test stand to test tires. We have LabView 7.1 and the SCXI chassis with an 1121 transducer card. I am trying to count the rate and total number of revolutions made by the tire. The signal is acquired from a 12V-proximity switch that is actuated once per RPM. The tire turns at 1,000 RPM or a little more.
    The signal will have to go through a 100-foot cable to get to the LabView chassis, will this be a problem?
    How do I get the 1121 card to read the switch and make it a 1 or 0 to count pulses?
    Will LabView be able to read this many pulses per second?
    How do I get MPH and a RPM reading out of it?
    Thank you,
    James Happe

    Hi James,
    Since you are cabling your DAQ board to an SCXI chassis with an 1121, you will not be able to use your counters without additional hardware.
    The 1121 is an analog input signal conditioning module. It performs filtering and attenuation to help measure analog signals. What it does not have is access to your board's counter pins.
    In order to use your counter pins you will need to get the necessary hardware. You have two options:
    1) Buy and SCB-68. This is a breakout box that will cable directly to your DAQ board replacing your SCXI chassis. You can connect your signals directly to your counter with this. However, I would advise against this because your application has a 12 volt signal. This will overload the 5v maximum voltage for your counter pins.
    2) Buy a 1180 feedthrough panel. This will allow you to use all of your DAQ board's functions with the SCXI chassis. Withouth the 1180 feedthrough panel, the SCXI-1121 is the only thing connected to your DAQ board. Since the 1121 only performs conditioning on the analog inputs, that is all you can access. The other pins cannot be used (no access). With the 1180 feedthrough panel, you can put a connector block on and access all of your other pins (including the counter pins). Again, I would advise against this since your 12 volt signal will overload your counter pins.
    My suggestion would be to perform an analog input task. Set up your 1121 in MAX and use a LabVIEW shipping example. In the shipping example select an analog input channel from your SCXI-1121 module. Set the appropriate voltage range and take some measurements. Once your signal is connected and you can read it using an analog input example you are half way there.
    Take the analog input shipping example and modify it to perform frequency analysis on the voltage readings. You can simply wire the data from the DAQmxRead VI into one of the frequency analysis VI's (noted in my first post). The output if that VI will give you the frequency of your signal.
    -Sal

  • Unable to measure pulse time, using Counter pulse time 1samp.vi

    Hi
    I am using pci6624 board to measure pulse time . I have selected counter 0 to measure  pulse time & connect the signal to gate0+ & gate0-.
    When i used Counter pulse time 1samp.vi to read the pulse time , i am not able to read the value and i am getting following error msg . If i used Counter DBL 1samp.vi  i am getting out put.
    Please help me
    Attachments:
    pulse_time_measurment.vi ‏11 KB
    Counter_errors.JPG ‏44 KB

    Hi,
    You can try changing the mode to counter -> single sample -> DBL in Daqmx read function
    You can also try this example 'Meas Pulse Width-Buffered-Cont.vi' or related examples from NI Example Finder.
    Cheers,
    Sahil Gupta
    NI India

  • Counting pulses and measuring flow rate per second

    Hi everyone
    I am using a compactField Point (cFP-2220) controller to measure the flow rate. The flow sensor that i have, gives the output in terms of the pulses. I need to count the number of pulses for a particular interval and divide it by a K-factor( constant value) to get the flow rate. If i select the interval to be of a second, i would want to count number of pulses per second and divide it by K-factor to get flow rate ( per second). 
    How do i count pulses per second and consequently measure flow rate using this count and K-factor.
    Any kind of help would be highly appreciated.
    Thanks in advance.

    You may be able to use the Edit Tempo function to work this out. With you waveform in Edit view Right Click on the time scale at bottom of waveform and select Bars and Beats display. Select a number of beats by highlighting with the cursor. Then again on the Time bar select Edit Tempo. In that dialogue you can try clicking on Extract to find the Tempo ie. beats per minute. Also you can try adjusting the tempo by entering avalue manually to see how close that gets to your waveform.
    Haven't used this function of Audition much so you may have to refer to the help file to find out more about it.

  • PWM counter pulse

    Hello, I am using the counter output of my DAQ 6255 to generate pulse width modulated output. I need to generate pulse trains with varible alternating pulse widths In the attached VI, I am using the DAQ write for writing into counter the variable high times and low times but some how it doesn't work the way I have set up the timing in the array. Can some one help me solve this issue?
    Attachments:
    Counter Pulse.vi ‏20 KB

    Hi MansoorEE,
    Hav you looked into the example found in NI Example Finder? Pressuming that you are using the USB 6225, you can open LabVIEW >> Help >> Find Examples... >> Search keyword "pulse width". You can also limit your result as shown on the botton left corner of the screenshot below:
    Hope that helps
    Warmest regards,
    Lennard.C
    Learning new things everyday...

  • Counting pulses - modelsim

    Hi everobody, I use modelsim to simulation my description. I would like to count pulses (clk) when pwm_out is high. How to do this ?  I attached file with print screen of my simulation. Thanks for fast reply!  Best regardsLukee

    Hi, I would synchronize the process to the clk explicitely...Oki, asnychronous reset could be a bad idea ;-)  process (clk, rst)  variable count : integer range 0 to 20000;
    begin
      if(rst = '1') then
        -- State machine  count := 0;   elsif(clk'event and clk = '1') then
        if pwm_out = '1' then      count := count + 1;
        else      if (count > 0) then        report "count =" & integer'image(count);
            count := 0;
          end if;
        end if;
      end if;
    end process;
     Kai

  • Count pulses with pci6601 and bnc2110

    Hi,
    I am trying to count pulses using a pci-6601 in combination with a bnc2110 connector block. I tried to connect a lolck wave to the 2110 but I dont know to which connector I should connect it. In the measurement and automation explorer I dont see any counts. Also in the measurement and automation explorer I can only choose pfi39 to 11 and I cannot find these on the 2110.  I dont know to which bnc connector pfi39 is connected and it does not say it in the manual.
    Any help is greatly appreciated!
    Toeno

    ear Sir,
    Thank you for your post. You should indeed use the BNC 2121. The BNC 2110 us not supported for the counter timer cards.
    To know a little bit about the routing from the signals you can compare the pinout positions from the SCB 68 to the positions with the BNC box. Connector layouts can be found under http://digital.ni.com/public.nsf/allkb/F011AD8B0F4BD35086257050006CBB70?OpenDocument
    But again the BNC 2110 is not supported for the PCI 6601,
    best regards,
    Martijn S
    Martijn S
    Applications Engineer
    NI Netherlands

  • NI-DAQmx: PCI - 6601 - counting pulses in fixed intervals

    Dear friends,
    I found, that similar topics to my question have already been discussed, but I was unable to find exactly my case, or where it is near - LabView is discussed. If you know address where my question already has been discussed, please, let me know. Because I still have not decided whether I will use CVI or other C-based environment, my questions are more oriented to the principles, I hope that no matter which C environment is used, the algorithm should be the same.
    Now to the question:
    For my project, I am using board PCI6601 and NI-DAQmx drivers. What I need to do is illustraded in the following figure:
    I time ago I have tried to realize the above function through the evalution CVI environment, but I filed. I have some questions regarding my experience:
    1. I have one general question: Is the functionality needed possible to be realized using the board 6601 and LabWindows/CVI (or Visual C environment )? If yes, please, comment the questions below:
    2. I suppose, a period measurement should be used, but which type? I suppose, a single period measurement should be used. The buffered continuous period measurement seems to be not suitable, because there is no way for ensuring the time T2 for system processing.
    3. How the measurement should be configured, which functions should be used? I tried to apply the function DAQmxCreateCIPeriodChan(..) and I noticed the following:
    - in order to be able to set the GATE time T1 according the needs, I must use for the parameter measMethod only value DAQmx_Val_HighFreq2Ctr;
    - may be the values for the parameters minVal  and maxVal need to be calculated each time dependently on the time T1 set?
    4. How should be organized the reading, which functions should I use to read the counter value? By now I tried to use the function DAQmxReadCounterScalarF64(...) and I noticed the following:
    - my system needs to know when the counting T1 is finished, in order to do the processing needed in the period T2. What value should I set for the parameter timeout in respect to this? Shall I use the timeout in order to obtain the result, or I must detect when the result is ready checking the Return Value of the function? Shall I use timeout, depending on the T1 period used?
    -  a number of pulses “zero” in my system is a normal value. How to avoid the problems, related to this? When I connect and disconnect the pulse source, an error occurs. I tried to use the function SetBreakOnLibraryErrors() to disable the error messages, and I succeeded to disable them, but it seems, on error the task is automatically stopps and needs to be restarted.
    - which variant is the correct way for reading with respect to the task start/stop:
    Variant 1:
    a) Start the task
    b) Start the counting
    c) Wait the counting to finish
    d) Stop the task
    e) Process the result
    d) repeat the sequence (a-e) so many times as the number of the countings;
    Variant 2:
    a) Start the task
    b) Start the counting
    c) Wait the counting to finish
    d) Process the result
    e) Repeat the sequence (b-e) so many times as the number of the countings;
    f) Stop the task
    Thank you in advance,
    Kamen Ivanov
    Message Edited by THE_SNAKE on 10-09-2008 05:41 AM
    Message Edited by THE_SNAKE on 10-09-2008 05:43 AM

    Dear
    Kevin,
    Thank
    you for your attention! Now step by step:
    > You mention a DAC -- do you have another NI board, maybe a
    multifunction board? If you do, or if you can add one, there's a pretty
    straightforward way to do this stuff well. Assuming there's an NI multifunction
    board available (I'd recommend an M-series board), I would approach this just a
    little differently.
    The
    only NI hardware I have is this 6601 counter board. It has enough general
    purpose pins, and I am using them to realize the digital part of the DAC. The
    additional analog components, needed to complete the DAC functionality are
    existing in the XPS system and they don't need to be added by me. The NI board
    only must provide the corresponding binary combination. In fact, by this moment
    I realized the DAC in this way, using a simple software routine to convert the
    decimal value to a binary output value on the general purpose pins, it seems to
    work fine (I have not explored its timing parameters yet – for example the time
    needed for the output to be updated).
    >The approach you've planned counts on making a near-real-time
    update of an analog output DAC based on measured results. 
    You
    got it right! Here I need to correct myself: the DAC update is always related
    to "moving" the DAC output with one step/level prior each counting. The
    DAC output value does not depend on the result from the last counting, I know I
    have written like this in my first message, excuse me for this! However, this
    does not change the task to be solved
    >Your data correlation depends on you stopping and starting the
    counting in sync with generating your DAC update.
    This
    is very well said!
    >It restricts you to doing software-timed AO as well. 
    I
    am not sure that I got this right, but if you mean the DAC update itself - yes,
    the DAC update is software driven.
    >All that can work, but consider the following approach that also
    uses an analog input A/D channel. I assume what you care about is the
    correlation of AO voltage to subsequent count rate, right? 
    What
    I need to ensure is that no single counting will be started prior its
    corresponding DAC update, and that after finishing a counting, the next DAC
    update will be done as soon as possible.
    > What *I* would consider doing first is to hardware-sync the
    counting task with an analog INPUT task which simply measures the analog output
    voltage.  It sounds kinda dumb at first
    to create a measurement task that measures a signal you're generating, but
    there are benefits to this approach.  It
    would free you to change the analog output DAC voltage any time and any way you
    want, without having to worry about the processing time spent on it.  Your master data record would be the count
    and analog input tasks, which can be synced in hardware.  
    Also, you would have a continuous record of count rate vs voltage
    with no "blind" time.
    I
    think I got your idea. But my problem is related only to the board 6601.
    May
    be we have to think how using only this board similar to your idea can be implemented.
    It
    seems, I can additionally simplify my question:
    Is
    the board 6601 suitable to be used for the task I need to solve, without adding
    any additional (NI) hardware?
    Because,
    if my task can not be solved easy using exactly this board, I will try to
    search other solution, but I need to know for sure and to have arguments, that
    this board alone is suitable/not suitable for the task I have to solve.
    Best regards:
    Kamen Ivanov

  • How can I specify a delay generate a counter pulse?

    Hi all,
      I have a question about using the counter to generate the pulse train. I don't have how to program it but I try the test panel in the MAX and I see it generates the pulse train at some rate and with some pulse duration. I am thinking if it is possible to generate only one pulse with given pulse duration at sometimes after I start the task? I have a code to output an analog waveform, the waveform lasting for 35ms. I wonder if it is possible to syncronize the output of the analog waveform as well as the counter such that at 12.5ms after the waveform output started, I send that single pulse from the counter port out. I have no idea how to do that, I am thinking to use a delay but it is hard to precisely control the time to exact 12.5ms.
    Solved!
    Go to Solution.

    PKIM wrote:
    Hi all,
      I have a question about using the counter to generate the pulse train. I don't have how to program it but I try the test panel in the MAX and I see it generates the pulse train at some rate and with some pulse duration. I am thinking if it is possible to generate only one pulse with given pulse duration at sometimes after I start the task? I have a code to output an analog waveform, the waveform lasting for 35ms. I wonder if it is possible to syncronize the output of the analog waveform as well as the counter such that at 12.5ms after the waveform output started, I send that single pulse from the counter port out. I have no idea how to do that, I am thinking to use a delay but it is hard to precisely control the time to exact 12.5ms.
    I found an example in the CVI show how to generate a single digital pulse
            DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
            DAQmxErrChk (DAQmxCreateCOPulseChanTime(taskHandle,chan,"",DAQ​mx_Val_Seconds,idle,initialdelay,lowtime,hightime)​);
            DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,​NULL));
            DAQmxErrChk (DAQmxStartTask(taskHandle));
    I have two questions. First of all, to create a pulse, does it mean we have low state for sometimes, then high state for some times and then low state again? So why there is only two time parameters (lowtime and hightime)? Is the minimum lowtime and hightime depending on the sampling rate of the card or depending on the OS? I am using 6711 card
    I see that I can specify initial delay, does it mean the time delay after the task just start?

  • Using a SCC counter pulse train to control a SCC digital out signal

    I am trying to send a digital high signal on a SCC-Digital ouput module for a certain number of pulses generated by a SCC-Counter/timer pulse train. I have found examples of how to route such signals through PFI12 etc on an M-series board but I am trying to achieve this without referring to the card, just the SCC modules themselves.
    I cannot find a way to use the sample clock from the counter generated pulse train to synchronise the digital output.
    Is there any way I can do this without referring to the connected M-series DAQ card channels?
    Thanks in advance for your assistance.
    Cheers.

    Hi Phil,
    The SCC carrier is only conditioning your signals (i.e. if your signals are not in optimal ranges, bandwidth or need external excitation). The actual counters and all digital lines are controlled directly by the M-series board. This means you will never be able to refer to a counter in the SCC module.
    If you route the signals of the M-Series board, is as if you had done so externally from the SCC. Look at this example and might give you more insight to how to implement it (This is software timing). The hardware timing would be doing correlation DIO. Here is an example that needs to be modified to adapt to your timing: http://zone.ni.com/devzone/cda/epd/p/id/4414
    Hope this helps,
    Yardov
    Gerardo O.
    RF Systems Engineering
    National Instruments
    Attachments:
    Finite Dig Output High.vi ‏31 KB

  • Determine when Counter Pulse Generation has been digitally triggered to start

    A counter task has been configured for continuous pulse generation with a digital edge start.  How in LabVIEW can I determine when an external digital trigger has been received and the counter started ?  It seems that a timed loop with DAQmx Create Timing Source wired to its source could be made to work but I cannot figure out how or the most appropriate instance to use.  I would simply stop the timed loop once the counter start had been detected.
    Steve

    Querying the output state and looking for a change would probably work for many typical square-like pulsetrains.  If you have an extreme duty cycle like 1% or something though, your queries are likely to keep finding the counter in the same output state long after pulses have started.
    Some other ideas of a similar nature may work better, though I'm not near a LV machine to test them.  I can vouch for idea #1 from past usage though.
    1. Query the counter's 'count' property and look for a change.  You're pretty unlikely to query the same count value several times in a row during pulse generation.
    2. You could try querying the DAQmx property for "TotalSamplesGenerated" and look for a non-zero value.  I'm not sure if this gets updated for counter outputs though.
    3. Counters also have a property called "TC reached?" where TC means terminal count.  When you query and get a True, It automatically resets itself back to False until reaching TC again.  Again, while I know this works for counter input tasks, I'm not sure if it gets updated for counter outputs.
    -Kevin P.

  • Counting pulses of a datataker with lab view

    my problem:
    I
    am trying to use lab view to visualize the measurements of different
    data - acquisition systems. At the moment I am working with the datataker DT50
    and I already did some temperature measurements with the datataker lab
    view driver. But when I tried to measure pulses (counts) I did not
    succeed. Is there someone who could help me solve this problem or who
    could send me a example vi to measure pulses from the datataker with
    lab view?thank you very much and best regards,
    jeroen

    Hi Everyone,
    This question has been answered.
    Thank you Julien for pointing to the correct website.
    This is the answer that was given.
    Hi Jeroen,
    With the DT50 there are two types of
    counters.
    The low speed counters use the digital
    terminals on the DT50, Digital channels 1 through to 5. You read them using the
    "C" command
    The high speed counters use the counter
    terminals on the DT50, Counter channels 1 through to 3. You read them using the
    "HSC" command.
    More information on these are on our
    website.
    For low speed counters
    http://www.datataker.com/Datalogger_Manual/The%20Low%20Speed%20Counters.htm
    For high speed counters
    http://www.datataker.com/Datalogger_Manual/The%20High%20Speed%20Counters.htm
    The dataTaker driver for LabVIEW, has the
    "C" command listed for the Channel Configuration cluster, so it will only read
    from the Digital terminals.
    However you can enter any custom command for
    the channels, in the channel number field if you list the channel type as
    "none".
    There is a brief mention of this in the
    driver documentation. The link below refers to the online
    documentation.
    http://www.datataker.com/products/Labview/Introduction_dataTaker_Instrument_Driver/datataker%20conce...
    It is listed under the heading "channel
    number"
    So in this cluster, you can enter the text
    "1HSC" in the channel number field to read in from counter one, and list the
    channel type as "none".
    You can also enter the text directly if you
    are using the low level VIs.
    Let us know if you have any
    questions.
    Kind Regards,
    Anthony Ulrich

  • Count Pulses in Labview without a counter function

    Hi All
    Is it possible to count input pulses without a counter function?
    I am using a Mydaq which only has one counter and it only counts up
    If I can count without a counter function, I can achieve all I need to achieve.
    I would need to be able to count up and down do
    Please advise if this is possible and if so, how.....
    Regards
    Greg

    Got it Sorted...

  • 6602 counting pulses on all 8 counters

    I need to count the number of pulses on 8 lines simultaneously.
    Each line will have a burst of 2MHz pulses.
    Can I do this on a PCI-6602 or will this need to be a buffered operation that will be limited by the available DMA channels.
    Also how many of the 32 digital I/O lines are used by the counters, if I use all 8 counters how many inputs will be left over for digital i/o use.
    Any help appreciated
    Nick

    Nick,
    Good news -- if you only need a total count for each of the 8 channels, you could perform unbuffered edge counting without requiring any DMA. When the bursts of activity have finished, you simply read the count stored in each counter.
    Counters 2-7 share their i/o pins with DIO 8-31. Counters 0 and 1 do not share and DIO 0-7 do not share, so you always have at least 8 DIO lines available for use.
    I recall that under traditional NI-DAQ, there were ways to operate DIO on some of the counter lines that weren't needed in their tasks. It took a little care to setup properly, but you may be able to free up a few more DIO that way. Counters 2-7 need their Source pins for their counting tasks, but their Gate and Aux pins should be available though possibly only as inputs. Output pins may also be available, but I'm less sure about that, and they may be restricted to output.
    I haven't tried this under DAQmx, but I kinda suspect it might wind up being a bit simpler to setup.
    -Kevin P.

  • Can daq 6035e,or 6024e used to count pulse train

    i need to count two digital pulse train coming from an encoder, whose frequency keeps changing. the encoder is a typical feed back from servomotor

    Hi,
    Both of those DAQ boards can measure digital pulse train frequencies using the counters. These cards can support 2-pulse encoder measurements on DIO6 and DIO7. This means that if there is a rising edge on Channel A the counter increments and a rising edge on Channel B decrements the count. You can also set the counter application for frequency measurement and that will measure the frequency of the pulse train on the line. These cards also have 2 such counters.
    There are many LabVIEW and CVI examples demonstrating this. If you search the site for position or encoder measurements there should be some example programs for you. Hope that helps.
    Ron

Maybe you are looking for