Time between digital inputs?

Hi, I would like to measure the time between a digital input being true.
Basically I have a prox picking put a point on a rotating shaft (to determine RPMs).
What I want to do is measure the time between consecutive input signals from the prox, divide 1 rev by the time, multiply this by 60 to get RPMs. Then compare that value to a set value ( say 300 RPM ). If it is equal or great, contine onto the rest of the program, if it is less than the set value, keep looping until it is greater than or equal to the set value.
Thanks in advance for the help!
Ryan
LV 7.1

If you need to measure accurately the rotation speed on a single turn, software timing may not be accurate enough, since the Window internal clock readings have lags (read "errors") of more than 10 ms (= 100 rps, about 2 rpm error), even when no other application is running. So either you count (and wait) for a given number of rotations, and calculate an average, or you use hardware timing with a counter on the DAQ card (if any)...
Otherwise, if you only need an estimate of the rotation speed, you can read the digital line and wait for 2 consecutive changes. The period can be calculated from the time stamps. See the attached vi. Wait a few seconds to observe the variations generated by Windows.
Merry Christmas, and Happy Wiring !
CC
Chilly Charly    (aka CC)
         E-List Master - Kudos glutton - Press the yellow button on the left...        
Attachments:
Rotation speed.zip ‏14 KB

Similar Messages

  • Actual time of digital input

    I am trying to record the actual time of the change in digital input pattern.

    Hello;
    You will probably need a combination of the digital board you have with a counter board.
    Then you can catch the intial time that the application starts, and then to count the PCKL pulses with the counter. You will need to stop the counter when the pattern you are looking for is matched (you can configire the 6534 board to generate a pulse when the pattern is match, and use that pulse to stop the counter).
    Since you know the TimeBase that the counter is using, to have the accurate time that the pattern was matched, you will need just to multiply the number of pulses the counter registered by the timebase, and add the initial time. I suggest you to work with the 660x counter board for that purpose.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • How to switch USB-6008 between digital input and output modes

    Hi I have been following the examples of setting a specific port to either inout or output using the DAQmxCreateDIChan() or DAQmxCreateDOChan() calls. What I now want to do, is switch betwen inout to output mode and back again.
    DAQmxCreateDOChan()
    DAQmxWriteDigitalLines()
    // do something
    //switch to input
    DAQmxReadDigitalU32()
    // switch back to output
    I can't seem to find any calls or discussions on this.
    rjmiller

    Hi RJM,
    If you want to be able to switch your digital line between input and output, then you will need to use the Tristate Property. There is another discussion forum with more detailed information about using this property and I believe that you have already seen it. I am going to post the link in case anyone else wants to see the other forum as well: Tristate Property Discussion Forum. Reddog's post is very informative.
    Regards,
    Hal L.

  • Accurate time between digital on/off

    Hi All
    I had posted this before in software board but i think this board is more appropriate. I am operating a valve which uses a digital signal (1 or 0) to switch on and off. I need to vary the time it remains open from 5 ms to 100 ms. I was using 'wait until ms' block up till now but it is not very accurate.
    I am attaching the final version of the program I am currently using. The
    daq card is pci 6516. We also have a PCI 6251 which as I understand can be used
    for hardware timing but am not really sure how to go about it. I
    would be greatful if someone could push me in the right direction. 
    Regards
    Abhishek
    Solved!
    Go to Solution.
    Attachments:
    DOD_valve.vi ‏27 KB

    You will not be able to use the CB-37F-LP with the PCI-6251.  I would recommend using the SCB-68 or the TBX-68.
    SCB-68
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/1180
    TBX-68
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/1182
    I attached another program that will output a digital high for 5ms and then a low for 100ms (like what you asked in the beginning).  This is all hardware based an relies on the clock frequency and what values I am outputting.  Currently the program has a clock rate of 200Hz and outputs an array of 1 digital high bit and 10 digital low bits for every clock edge.  To just send one pulse out of the card you would need to just change the array that is written to the output and change the sample clock to finite samples. 
    Message Edited by Jordan F on 01-16-2009 05:11 PM
    Regards,
    Jordan F
    National Instruments
    Attachments:
    CorrelatedDO[1].vi ‏23 KB

  • Measuring times of digital events on a NI PCIe 6259

    I am trying to figure out how to acquire time stamps every time a digital input (Boolean) changes values relative to the beginning of a AO output. Ideally, I would like to reset the time stamp to 0 each time the AO output occurs (different trials). Both counters on the 6259 are free, however I am already using the ao/SampleClock in my VI. Thank you for any help.

    Hello Joes,
    Since you have 0-30 events which you want to measure the time of, it would be easiest to calculate the time in post processing. You can use a start trigger to trigger both the analog output and the digital input.  Using the start trigger will synchronize the start time. The high to low transitions can be found in the recorded data and the time can be calculated using the position in the data array and the delta time between samples.
    Eric
    Eric Liauw
    AE Specialist - Automated Test | CLD | CTD
    National Instruments

  • How can i measure the time between two successive rising edges ,using digital input ..

    Hello
    I'm trying to measure the time in seconds between each two successive rising edges on a digital input .
    Till now I have managed to detect the rising edge ,increment a counter with each rising edge ,and snap the time at which the rising edge happenned
    all I need now is to subtract the current rising edge time from the previous rising edge time in order to calculate (T) which can be 1/frequency and display it in realtime to the user.
    but I don't know how to do this
    Can somebody please help me !!!
    note: the time that I'm measuring ranges between 200 ms - 2 seconds
    Solved!
    Go to Solution.
    Attachments:
    Counter without time.vi ‏11 KB

    Cheers for that. It's always a good idea to post your SubVIs as well - the problem could be in one of those.
    To help you out:
    You already know how to use shift registers so why not use one again for time? Create a new shift register for  the time then simply compare the "rising edge time" to the the previous time stored in the shift register and then write the new time to the shift register.
    Just a few other pointers:
    1. You'll want to initialise your shift registers ie wire a constant to the left hand register outside of the loop. This will cause the register to be reset each time the program is run. This is so that your counter will start from zero each time you run your code.
    2. You don't need to use the "greater than?" compare function with boolean as they can only be true or false (1 or 0)! The "Equal?" function is what you should use here.
    3. Lastly, it's a small thing but you can use the same tunnel that feeds into a case structure in each of the cases - no need to create two tunnels for the true and false cases, use the same one.
    -CC
    "If anyone needs me, I'll be in the Angry Dome!"

  • How can I measure the time between each two successive rising edges ,using Digital Input ?

    Hello
    I'm trying two measure the time in seconds between each two successive rising edges on a digital input .
    Till now I have managed to detect the rising edge ,increment a counter with each rising edge ,and snap the time at which the rising edge happenned
    all I need now is to subtract the current rising edge time from the previous rising edge time in order to calculate (T) which can be 1/frequency and display it in realtime to the user.
    but I don't know how to do this
    Can somebody please help me !!!
    Solved!
    Go to Solution.
    Attachments:
    Counter without time.vi ‏11 KB

    Woah!  
    Sorry Apok, but your code is becoming way too complicated/messy. I don't think that all of those shift registers or boolean conversion/operators are needed at all.
    If you want to measure the timing between two button presses then this is a different (much less complicated) way. It simply records the timing of the button press into a shift register then compares the two.
    Spoiler (Highlight to read)
    Of course this is a very quick and basic solution just to show you that it can be much simpler than you are making it (remember to use the mechanical actions of the buttons to get the behaviour you want).
    A better way would be to use an event structure looking at value changes of the buttons to determine the timings between clicks.
    -CC
    "If anyone needs me, I'll be in the Angry Dome!"
    Attachments:
    Time between clicks.vi ‏9 KB

  • How can I measure time between transitions at digital input

    I am using LabVIEW 6.0 to measure the time duration between 2 transitions in a digital input port. I have a set up including an HP 34970A Data Acquisition unit with the 34907A Multifunction Module plug-in. The LabVIEW program is trying to poll the digital input for level changes and then using the Time function(Tick Count) to check the times at the transitions. However this method doesn't work reliably as I have to measure time periods of 500ms.
    Is there any good way of mesuring time period with the above setup. I don't have a module which connects to the internal multimeter in the 34970A. The other stuff I have are a HP 34903A(Actuator Module) and a HP 33120A(Function/Waveform Generator).
    Any method for m
    ore accurate time measurement with the above setup will be appreciated. If not, what else do I need to make accurate time measurements.

    Frankly I doubt that you're going to be able to measure time interval with much accuracy. You're periidically polling a static digital input and how often you poll is going to vary. You could try polling as fast as possible and eliminate as many background tasks as you can. If your tolerance for the measurement is plus or minus 100 msce, then maybe you'll get a decent measurement most of the time. If it's plus or minus 5/10 msec, then it will never happen. The pc's clock is just not that accurate and a software timed loop on Windows is not deterministic enough. Get a counter/timer board for something really accurate or use a scope to capture the waveform.

  • Digital Inputs do not record over long time periods

    I am running Signals Express 2009 with a USB-6009.  I have a project that needs to record the states of 8 digital inputs over a 24 hour period.  The inputs typically do not change state for long periods of time.  When I run the project it does record and gather data if I stop it "soon"(I have gone as long as 30 min.)  When I leave it running overnight it does not appear to record anything.

    If you have not already, you should try turning off display updates in the "Operate »Update Signal Views While Running" menu item.  Set this to Update None.  Also, turn off "Prepare log data for viewing" under the Logging part in the Tools » Options dialog.  
    When I ran your project overnight, it ran out of memory.  The first error it threw was "Not enough memory to complete this operation."  The problem was that SignalExpress saved a great deal of data in memory for easy displaying while it's running, but this grows too big when it runs overnight.  The second error was as follows:
    Logging Stopped:
    Logging was stopped because an error occurred with a Step in the Project. 
    If this error is because of a device buffer overflow, you can improve performance by turning off display updates using the "Operate »Update Signal Views While Running" menu item.
    You can also change the way signals are logged by changing the Logging Options in the Tools»Options dialog.  
    Turning off  the "Prepare log data for viewing" will greatly improve performance. 
    Mark E.
    National Instruments
    Schedule a Free 1-Hour online LabVIEW Tutorial with an NI Applications Engineer

  • Generate complement​ary digital signals with dead time between each pulse and controlled by duty ratio

    I am to generate  two complementary digital signals using NI 9606 conected by RIO Mezannine Card to NI 9683 (Half Bridge DO).
    I am able to generate the signals but I am not able to put dead time between high and low signal and also, low and high signal.
    Requirement:
    (1) When the first signal goes high and the second signal goes low, there should be a controllable dead time.
    (2) Also when the second signal goes high and the first signal goes low, there should be a controllable dead time.
    I am able to do requirement 1, but I am unable to fulfill requirement 2.
    Please have a look at my VI and let me know how to go about satisfying requirement 2.
    Attachments:
    complementary test 2.vi ‏69 KB

    Hi Frank ,
    I have already taken note of the example Tannerite has provided  and have built my vi ( attached in previous post) surrounding that example.
    Now I require to control the PWM duty cycle as you can see from the vi using a knob and that control refers to both the signal 1 and 2.
    Now the signal 1 end and signal 2 generation requires a controllable dead time. Similarly, signal 2 end and signal 1 geneeration also requires another controllable dead time.
    I am able to do either one dead time at a time using delay but not two dead time simultaneously.
    I feel that I have two put the delays at the appropriate data flow point. I am working on that.
    I would really appreciate if you could give some insight on how to solve this dead time issue and generate two complementary waveform with dead times whose duty cycle can be controlled by a knob controller in fronty panel .
    I have also posted the required timing diagram for reference as suggested by Tannerite.
    Best regards.

  • Digital input and digital output at the same time

    Hi all
    I have a PCI-6503 board. I have done 2 task that run simultaneously: the first one is port0_16 output and the second one is port2 input.
    I get sometimes (not every times...this is strange...) error-200587 saying:
    'Requested operation could not be performed, because the specified digital lines are either reserved or the device is not present in NI-DAQmx.
    It is possible that these lines are reserved by another task, the device is being used through the Traditional NI-DAQ interface, or the device is being reset. You might also get the error if the specified resource is currently in use by LabVIEW network variables bound to the DAQ Channel, or if the DAQ Channel is being used in any OPC Client software.
    If you are using these lines with another task, wait for the task to complete.  If you are using the device through the Traditional NI-DAQ interface, and you want to use it with NI-DAQmx, reset (initialize) the device using the Traditional NI-DAQ interface. If you are resetting the device, wait for the reset to finish.'
    In the attached VI i have recreated the basic structure of my real VI (the error is present even here of course...).
    How can i do?
    I want to have both digital input and digital output with the same PCI-6503 every single cycle... Is it possible?
    Please help me!!!
    Kind regards.
    I love the smell of napalm in the morning
    Attachments:
    DIO simultaneously error.vi ‏31 KB

    Hello Maverick,
    Did you have any luck with the example Raven sent you?
    In Raven's example, it properly passes the DAQmx task from one SubVI to another to avoid having to open the task again. These errors are likely to occur when you have multiple DAQmx calls in a VI that call the same task again without clearing the previously opened task. If at any given time you try to open a task that already is being used, you might receive an error "resource is reserved"... similar to your original example.
    If you are interested, here is an awesome link that gives a detailed explanation of the LabVIEW dataflow paradigm
    Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications
    Thanks and good luck!
    Jordan Randall
    National Instruments Italy

  • How can i measure the time between a pulse output and a pulse back on the input?

    Llo,
    I have a problem i use a ultrsonic sensor, and when i send a pulse out of 4V then a couple of ms i have a pulse back on the input, how can i exactly know how much time there is between the 2 ^pulse??

    Use the output pulse to trigger a counter in period measuring mode and stop the counter on the return signal (if the input return signal is large enough to reliably trigger a logic circuit). If the signal is not large enough to trigger the counter directly, an external comparator can be used to generate the stop signal.
    Another approach is to use two channels of analog input. Feed the output signal to one of them and the return signal to the other channel. The time between outgoing and return pulses can be determined from the sampling rate. If precise timing is required and your AI board does not have simultaneous sampling, you have to account for the inter-channel time as well.
    Lynn

  • Acquire Analog and Digital inputs at the same time with 6025E card

    I have 6025E DAQ card, all the analog channels are used
    up. There are several digital signals, such as flowmeter. Can I acquire both kinds of data at the same time with my 6025E card? Thanks for your help.

    I suggest you search the examples that ship with LV
    Digital
    Find Examples>>>Hardware Input and Output>>>Digital Input and Output>>>8255
    for doing each type of I/O seperately.
    When you have found two examples. Just try to run the two at the rate use need in your final app.
    Post follow-ups Q's here. I am not personally familiar with that deveice so I can not speak from experience.
    I would generally expect that if you sample rate is low (i.e. <10Hz) you maybe happy with the results. If you want to run faster or have the PC do something else at the same time, the timing of the signals form the DIO lines may be suspect.
    So...
    It depends.
    Trying to help,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Setting time critical digital output based on axis position (PCI-7358)

    HI,
    I need to set a time critical digital output based on encoder position (this will switch fast acting valves). I was planning to try the general purpose DIO but I can't find any examples, I have been through the manuals, searched the site etc. Where can I find help with this, all the examples only seem to deal with digital input triggering or RTSI? I'm thinking of an onboard program that just monitors encoder positions and sets digital outputs.
    Some time back I seem to remember reading that general purpose DIO should not be used for time critical operations, is that correct? And if so what are the other options - RTSI going to another DIO board? The DIO really needs to be deterministic, is RTSI the only option?
    Any advice appreciated / Martin
    Certified LabVIEW Architect

    Even with an onboard program you will always get a delay of several milliseconds between your axis has crossed the position and until the digital outputs are set. If this is ok for you then you could choose this approach.
    For the case that you only want to toggle one digital line the Breakpoint feature should be the best solution as it toggles the breakpoint output almost immediately when the breakpoint positions are reached.
    If you need to change a whole pattern instead of only a single line then the approach you mentioned would be the best solution (RTSI and high-speed DIO like the 653x boards). Combine this approach with the breakpoint feature by routing the breakpoint output to RTSI and using this as a update clock signal for the DIO board.
    Best regards,
    Jochen Klier
    National Instruments Germany

  • Convert digital input to a velocity graph

    I've set up a hall-effect sensor to measure the velocity of a bicycle wheel as I rotate it.  It provides a digital input into labview, from where I can calculate the veloicty based on the rpms.  I've managed to find a way to work out the velocity of the wheel after the fact, but is there anyway that I can program labview to show me the velocity in realtime?

    Do you have an example of a rolling average?  I have used the Passive digital realization filter  at http://en.wikipedia.org/wiki/Low-pass_filter .  Is this considered a rolling average?
    yn = αx + (1 − α)yn − 1
    where:
    yn is the current output value
    yn − 1 is the previous output value
    x input value
    Δt is the time interval between samples
    RC is the time constant
    This works pretty good but I would like to use a rolling average with n data points where the n data points are averaged and the array is updated with new measurement value.

Maybe you are looking for