I want to measure rpm using 100 ppr incremental encoder via digital input

i want to measure rpm using 100 ppr incremental encoder  via digital input max speed (4000 rpm)
am using 9178 c-DAQ chassis and 9426 digital input module
pl provide me example code for this

Hi asaccullo.
The recommended settings for encoders are using the counters in the daq cards. Using digital I/O’s is not recommended, the encoders send digital signals but one of the main differences between using digital IO vs counters is that counters are designed to handle these type of events.
Here I found several examples in ni.com/code that you might check:
Imitation Quadrature Encoder with DAQmx Counter Tasks
Use Counter Frequency to obtain an Encoder Rotational Speed
An Elvis is a daq device, so this should work for you.
I also found an example for myDAQ, it uses the DIO but with a counter task in the set up.
Regards,
steve.bm
AE | NI

Similar Messages

  • How to measure RPM using digital I/O

    Please tell me how to measure RPM using Digital Input or please give me a code for this.

    You probably aren't going to find anyone to just give you code. Especially because you don't specify the hardware you're using. Doing this on FPGA is different than using DAQmx to do it. With FPGA you count pulses over a specified time. Using boolean logic from the digital DI node is a common way but there are others. (if you are using FPGA I can draw up an example, but I believe there is one on NIs website if you search google for it),. Then, if you want, you can run the data through an IIR filter, especially if you have a low resolution or slow moving encoder. Either of these conditions can result in very large difference of RPM even if the actual speed is not varying much (if you need an example why I can provide more detail, but some simple math calculating RPM should explain this. Obviously lower resolution will giv eyou less accurate results).
    If you use DAQmx you can set up a frequency task and it will return the number of pulses in a specified time frame; then you can convert this to RPM based on your encoder resolution and take the same steps of running it through a filter to smooth it out if need be.
    CLA, LabVIEW Versions 2010-2013

  • I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel

    I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
    When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

  • What is the correct way to measure RPM using Visual Basic?

    I have something that works now, but I want to know if there is a better way. I am using a 6023E, I have a Hall Effect switch that goes low then high each rev when a magnet goes by. I have the signal connected to the GATE pin on counter0. I poll the card for the RPM over and over using code based closely on the example STCsinglePeriodMeasure. While this works, I'm not sure exactly what this code is doing. Do I need to call the entire thing every time? The problem is I need to reset and arm the counter each time before starting the counter, and calling everything was the only way I could get it to work. I'm looking for a way to either trim this down, or maybe there is another way altogether that is more apporpriate. Here's the code:
    iDevice% = 1
    ulGpctrNum& = ND_COUNTER_0
    ulArmed& = ND_YES
    ulTCReached& = ND_NO
    iYieldON% = 1
    iStatus% = GPCTR_Control(iDevice%, ulGpctrNum&, ND_RESET)
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Control/RESET", iIgnoreWarning%)
    iStatus% = GPCTR_Set_Application(iDevice%, ulGpctrNum&, ND_SINGLE_PERIOD_MSR)
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Set_Application", iIgnoreWarning%)
    iStatus% = GPCTR_Change_Parameter(iDevice%, ulGpctrNum&, ND_SOURCE, ND_INTERNAL_100_KHZ)
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Change_Parameter/SOURCE", iIgnoreWarning%)
    iStatus% = GPCTR_Change_Parameter(iDevice%, ulGpctrNum&, ND_GATE, ND_DEFAULT_PFI_LINE)
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Change_Parameter/GATE", iIgnoreWarning%)
    iStatus% = GPCTR_Change_Parameter(iDevice%, ulGpctrNum&, ND_INITIAL_COUNT, ulCount&)
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Change_Parameter/INITCOUNT", iIgnoreWarning%)
    iStatus% = GPCTR_Control(iDevice%, ulGpctrNum&, ND_PROGRAM)
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Control/PROGRAM", iIgnoreWarning%)
    ' Loop until 'ulGpctrNum' is no longer armed, or run window is closed.
    Do
    iStatus% = GPCTR_Watch(iDevice%, ulGpctrNum&, ND_ARMED, ulArmed&)
    DoEvents
    Loop While ((ulArmed& = ND_YES) And (iStatus% = 0)) And RunWindow.ExitStatus = "Running"
    If RunWindow.ExitStatus = "Running" Then
    'Run window wasn't closed, so read data.
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Watch/ARMED", iIgnoreWarning%)
    iStatus% = GPCTR_Watch(iDevice%, ulGpctrNum&, ND_COUNT, ulCount&)
    iRetVal% = NIDAQErrorHandler(iStatus%, "GPCTR_Watch/COUNT", iIgnoreWarning%)
    iStatus% = GPCTR_Watch(iDevice%, ulGpctrNum&, ND_TC_REACHED, ulTCReached&)
    If (ulTCReached& = ND_YES) Then
    MsgBox "Counter reached terminal count! RPM value may be incorrect"
    Else
    'ulCount is the period in microseconds, RPM = 1/val*(100000ms/s)*(60s/min)
    RPM = 6000000 / ulCount&
    ' Debug.Print RPM
    RunWindow.RPM.Text = Str(RPM)
    End If

    Finally getting around to this again. My previous post is incorrect, as the code I am using is based on the single period measure (it's right there in the code). I am having a problem with the values returned with this method. Occasionally, the card will return a lower than expected count, resulting in a very large (and incorrect) RPM value. I'm thinking this must have something to do with arming the counter at some unfortunate and coincidental point on the gate signal, resulting in a short count. It must be an unlikely event, because I get thousands of good, consistent values for every one bad one.
    To resolve this, I am thinking of going to the single buffered period measurement as suggested above. My idea is to set up a buffer with two values,
    and always take the second one (to avoid coincidental arming and short counts). I could also set it up to return more values, and the application could choose the most likely one (ie return three values, throw out the largest and smallest, etc.)
    I would rather just use the buffer in continuous mode, since the RPM varies much more slowly than the counter counts, and any snapshot of the buffer at any time would be sufficient, even in the presence of overwriting, etc. This would allow me to arm the counter once and poll it on the fly.
    My concern is that in continuous mode, the counter will be throwing a lot of errors which will interefere with the program flow. Can I just set the counter to suppress all errors when I do a buffered read? Worst case, I get a value as it is being written to by the counter, which will have some garbage value (hopefully a recognizable signature) which I can throw out in favor of the other values.
    Thanks,
    Doug

  • Measuring rpm using DAQ device

    How to measure the count value determined from the encoder to rpm value?Cn anyone pls explain?

    1. Write a program to read a count every second.
    2. Find count differene between this loop and previous loop.
    3. rpm=count difference*60/pulse per round.

  • Using a 9205 to measure RPM

    I have not used labview in over 10 years but now have an application that requires but I am more then rusty. I am trying to measure RPM using a 9205 module and I am sure there is a way to do it. I have a pulsed voltage output from my measurement circuit and so far I am capturing the voltage. Can someone suggest a way to convert these voltage pulses to an RPM value. I am sure some type of leading edge counter would work.
    Thanks

    Not the cheapest route but there is a SCXI card that measures frquency.
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/1661
    There may be some other frequency cards this is one I have used in the past.  With this card you can create a virtual channel and ask it what frequency the analog signal is going into it.  From here there is a conversion from frequency to RPM depending on the type of resolver or hall signal you are using to generate that signal.
    This method is the easiest but the cheapest would be to get a cheap AI DAQ device that can measure several times faster than the generated signal (nyquist theorem) then analyze the series of AI reads to determine the frequency.  Then convert frequency to RPM.  Depending on the signal a USB DAQ device might work, if not a PCI or PXI + MXI card would still probably be cheaper than the SCXI route.
    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 measure the rpm using NI 9411 and counters

    How to calculate the rpm of a shaft using NI 9411 and counters?

    http://forums.ni.com/t5/Signal-Conditioning/measuring-rpm-using-DAQ-device/m-p/2571131#M7353
    Additionally, if you set it to read a degree instead of pulse, your calculation will change a bit, but I'll leave that to you.

  • Measure data using RS-485 Port on cFP-2120

    I have cFP-2120 with one RS-485 Port, One RS-422 and one RS-232 Port available, i want to measure data using the exisiting RS-485 Port on cFP-2120.
    I have Rx and Tx Signals from my equipment. Two wire
    Also i have RS-485 Enabled device with 4 port availble. I want to use RS-485 connected with RJ-50.
    Also give me pinouts for Rx and Tx.
    Thanks.

    I am a little confused by your statement "I have cFP-2120 with one RS-485 Port, One RS-422 and one RS-232 Port available".  The cFP-2120 has 3 RS-232 ports and only 1 RS-485  (or RS-422).
    Look in the manual for the cFP-2120.  Here is a link. http://www.ni.com/pdf/manuals/371380b.pdf  Pages 3-7 thru 3-10 have information and pinouts for the serial ports.  It also tells how the RS-485 port is a 4-wire port, but it can connect to a 2-wire RS-485 installation with jumpers and special programming to account for the echo back of outgoing commands.  Another alternative to 4-wire to 2-wire conversion is to get an RS-485 isolator that would have switches to set one side to 4-wire and the other side to 2-wire.  I have used this one from B&B electronics successfully.  Though you say you are using 4-wire on your device, so you would not need it unless you have the need for electrical isolation between the device and your cFP.  Perhaps the discussion of 2-wire was a misunderstanding.
    Remember that the transmit lines from your device will go to the receive lines of your cFP and vice versa.  The polarity of + and - should match between the two devices.  TX+ to RX+, TX- to RX-,  RX+ to TX+,  RX- to TX-, and GND to GND)
    As for VISA, you would just configure it like you would any RS-232 device with the baud rate, parity, and stop bits to match your device.
    Centerbolt, thanks for the kind words and posting the link to the other thread.

  • Calculate RPM using NI 9402

    I am attempting my first simple Labview DAQ project, though I am more comfortable with Signal Express.
    My torque sensor has a +/- 5Vdc, 60 pulse/revolution speed output. The speed will be up to 200 RPM, so I was aimed towards a NI 9402 High Speed Digital I/O module for my CompactDAQ chassis. When I used DAQ Assistent to configure the counter, it indicated that there were no supported devices found. Is there some easy code to calculate shaft RPM with the 9402 configured as a digital input?
    Thanks
    Solved!
    Go to Solution.

    I have the same module and am also trying to calculate RPM from a transducer that outputs 60 pulses/revolution however I am using the cRIO platfrom and I believe the Express scripts do not work with cRIO, correct? What would be the best way to go about programming this calculation then?
    Best,
    Dan

  • I want to measure above 100 points

    Hello!
    By Keithley 2400, I want to measure above 100 points. In my program, the poits that I can measure are only 100 points. How can I fix this problem? If you don't mind, could you modify my program?
    Attachments:
    ASK.vi ‏91 KB

    KUB,
    It seems as if this is the third time you've asked the exact same question, and you never responded to the solution that was suggested the very first time you asked it. Do you understand that the person who answered you there (lesher) attached an image that shows a suggested solution?
    You should go back to that original thread, examine the proposed solution, and--staying in that thread--ask a follow-up question (click the "Reply" button) if you do not understand something. If you do ask another question, you need to be very detailed and specific about what isn't working, or people won't be able to successfully help you.
    Keep in mind that LabVIEW 6.0 (a fairly old version at this point) is really going to limit the number of people who can make modifications to your code and re-save it in a format that you can use.
    Regards,
    John

  • Measure rpm and PWM signals using digital input of NI9401 module

    Hi, is there a simple way how measure rpm (to 5000 rpm) and PWM (about f=3kHz) signals using digital input of NI9401 (ultrahigh-speed digital I/O)  module plugged in NI 9172 ?  I will wellcome any suggestions and VI examples (bether still). I'm begginer using LView 8.2. I apologize for my poor English. Many thanks.

    Hi CUA,
    Since you have already the right tools, you just need to get started with the software. The NI-9401 will give you access to the counters that are inside the cDAQ chassis 9172.
    You need to place the module in slots 5 or 6. You can read in how they work and how to configure them in the counters section of the user guide found here.
    Now to measure rpm, you can either measure the period of the signal (seconds) and multiply by 60 to have minutes and the number of ticks per revolution. You can find a shipped example to read period called “Meas Dig Freq-Buffered-Cont-Large Range 2 Ctr.vi” found under Hardware Input and Output » DAQmx » Counter Mesurements
    To measure PWM, it is similar procedure and you can read the semiperiod (high time or low time). There is also a shipped example called “Meas Semi-Period.vi” found under the same location.
    There is great information for these kind of task at this page or just post back if you need to.
    Hope this helps.
    Gerardo O.
    RF Systems Engineering
    National Instruments

  • Can I measure AC voltage using FP-AI-102? I want to measure in the range of 0-120 VAC

    Can I measure AC voltage using FP-AI-102? I want to measure in the range of 0-120 VAC

    Hello Luis,
    The update rate on the AI-102 module is 360Hz, which means that you can only accurately acquire waveforms with frequencies below 180Hz. 
    FieldPoint wasn't made for high speed measurements, so you will have to make sure that you are able to acquire the waveform you want to with the hardware that you have.
    If you want to know how you would do the acquisition, I urge you to take a look at the LabVIEW shipping examples.
    Help»Find Examples... and browse to Hardware Input and Output»FieldPoint»Analog IO
    As for writing to the file, you can take a look at examples under Fundamentals»File Input and Output.  You can use the functions included in the Functions Palette under Programming»File I/O.
    I hope that this helps!
    Kameralina
    Ask NI (ni.com/ask)
    Search The KnowledgeBase
    NI Developer Zone
    Measure It. Fix It. ni.com/greenengineering/
    NI Vision ni.com/vision/

  • Hi Guys I want to measure the rpm for dc motors?

    Hi
    could you please some one help me to generate a code to convert count edge to rpm?
    Regards

    Hi,
    The method you use for doing this does depend on what hardware you are using. You need to be sure that you can sample the encoder fast enough to catch all of the digital edges.
    Please find attached a good example if you are simply using a digital input device:
    https://decibel.ni.com/content/docs/DOC-18586
    Thanks,
    Aaron
    Aaron. E
    Applications Engineer Team Lead
    National Instruments
    ni.com/support

  • Problem to measure 0% and 100% duty cycle of a PWM.

    Hi,
    I am using counters of USB-6341 to measure duty cycle of PWM just by following the example 'Meas Duty Cycle-Buffered-Finite.vi'. It works almost all the time. However, when the duty cycle of a input pwm is 0 or 100%, the DAQ can't read anything, in another word, it can't measure 0 or 100% duty cycle.
    How to modify that?
    Thank you very much :-)
    Nan

    That's the thing about PWMs, you never really know if the PWM is 0% or 100%.
    Let's say we have a 50% duty cycle, at 1/2Hz.  So low for 1 second, high for one second right?  What if we run at 1/20Hz, so low for 10 seconds high for 10 seconds.  Or is this a 0% duty cycle for 10 seconds, and a 100% for 10 seconds?
    A true PWM read will never be 0% or 100% it will just keep waiting until the trigger is seen, and recalculate the frequency and duty cycle of it.  The solution to your problem is for you to define a duration to watch for a change, and if one isn't seen, then you can define 0% or 100% appropriatly.
    So I would recommend taking your duty cycle like you normally are, and then at the same time watch the digital signal for however long you want, if the digital line does not change state, then output 0% if it is low and 100% if it is high and ignore what ever duty cycle you read.  But if the digital line does change state, then use the read duty cycle as the actual value.
    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 can I measure RPM with CTR-500 module?

    I have used  the CTR-500 module for mesurement of  motor RPM. But it doesn't have direct option to measure  RPM ,
    so i have count pulses for  1sec (then reset the counter) and  by calculation show the result for 1min. But it varies every time ,cant give me fix RPM.
    I want reliable solution for this.

    min
    You have not said how much the RPM actually varies from reading to reading and what the range of measured RPM is for the process.  This variation can be caused by a couple of things.  One would be actual variations in RPM due to changes in motor loading.  What is this motor driving?  Most RPM readouts use some form of sample averaging to smooth out the readings.
    A second cause could be your vi.  Suggest you post a copy of your vi. 
    In case you have not seen it, here is a link to a KB about measuring frequency with cFP.  It also links to several other docs on the same subject .  http://digital.ni.com/public.nsf/allkb/D8DB42F9FDC3607E862568640047F144?OpenDocument 

Maybe you are looking for