2-Bit Quadrature Encoder without counters

I've noticed that the internal help in LabVIEW only mentioned Quadrature Encoders in terms of reading them with the counter inputs of a device that supports that type of reading. In case your DAQ does not support those counter inputs, such as the NI USB-6008, here is a LabVIEW VI that reads the output of a 2-bit encoder such as the Grayhill 61C22-01-04-02 optical encoder, and also reads its pushbutton output. Note that this would be called an "X4 decoding" in LabVIEW terms when referring to the decoding operation that it implements.
Datasheet: http://eceserv0.ece.wisc.edu/~morrow/ECE315/ARM7-FPGA/datasheets/grayhill_61C.pdf
Wire the encoder up with the load resistors listed in second page of the datasheet, and tie one of the pushbutton pins to 5V.
The VI labels the physical channels that you should wire up to. Example:
DAQmx Device Name: Dev1
Encoder 5V Supply Channel: /port0/line0
Note that I delete the device name from the channel selector, so "Dev1/port0/line0" becomes "/port0/line0". I only break the Device and channel names into 2 selectors because I swap DAQs often and I prefer to write my programs to just take a single "DAQmx Device" input that I can change in one place, then leave all the other lines the same. Just a little quirk of mine I guess.
The "X4 Quadrature Encoder (SubVI).vi" and its subVIs are the ones doing the work, the parent VI is just an example of how to use them.
I hope this helps somebody.
Ryan R.
R&D
Attachments:
Rotary Encoder Example.llb ‏100 KB

This was very helpful actually, thanks!

Similar Messages

  • How can analog signals are measured every several counters from Quadrature Encoder using USB-6221

    how can I sample analog signals every counters from quadrature encoder using usb-6621?

    There is a well documented example of what you are trying to do at :
    http://zone.ni.com/devzone/explprog.nsf/webmain/DD85F07A7CA99F8F862568690062DE54?opendocument
    Don't be afraid because of the BNC-2120. It is just used in this example to simulate the pulses from a device. So it is not needed in your case. Obviously, you will need to change the number of increments/rev according to your encoder to get correct RPM values.

  • Simulate quadrature encoder output without hardware

    I am brand new to Labview and have not had any training other than youtube and this fine forum. I am a mechanic trying to solve a problem using labview. I am posting this new question because I don’t have any hardware so I can’t use the examples I’ve seen others pointing to.
    I’m trying to simulate the output of a quadrature rotary encoder. Once I have done that I want to use Labview to program an instrument that reads that signal and makes mathematical calculations to it but I need the signal first. The encoder will attach to a shaft that will rotate clockwise and then counterclockwise at a rate of about 122 times a minute.  The total shaft rotation will be between 0 - 18 degrees. It is important to me to know the direction of the shaft. The quadrature encoder will send out 2 square waves with one wave behind the other. The way I’ve tried to do this is by using 2 Simulate Signal modules each sending out a square wave at 2 Hz. I’ve connected a single knob controller to the both frequency inputs of the signal modules to simulate the speed the shaft rotates back and forth. I’ve done the exact same thing to the amplitude input to simulate the degrees the shaft turns before changing directions. My problem is the changing directions. I can delay the phase, which is what I want to do, but I can’t do it in real time and I can’t do it in a single 180 degree step. What I would like is a switch to change the B channel from +90 to -90 when it is toggled. If I could then toggle the switch when the amplitude reaches 18 degrees or less I will have an encoder signal. Thanks for any help you can provide.
    steve
    Attachments:
    Rotory Encoder.vi ‏59 KB

    Steve,
    From what I understand, you want to make a 180 degree phase shift every N intervals?  I modified your code to do this.  Let me know if that gets at what you are doing.
    Cheers,
    Chris LS
    National Instruments
    Applications Engineer
    Visit ni.com/gettingstarted for step-by-step help in setting up your system.
    Attachments:
    Rotory EncoderEdit.vi ‏61 KB

  • Can I use the 'Export Signal Property Node' on a quadrature encoder?

    Hi,
    So I don't know which counter board I'd be using yet for this (it's used in conjunction with a PCI-6280--the PCI-6280's counter inputs are all taken and so I need another board), but assuming this is possible at all in DAQmx I wouldn't mind knowing whether, say, the PCI-6601 (or any other timer board for that matter) could do this. I'm programming this in LabVIEW 2010 by the way. 
    I want to have a counter which counts the number of pulses on one channel (I'll call this the 'clock' channel) between when another channel goes from low to high (which I'll call the trigger). It's basically a pulse width measurement, but I only care if there are more than n clock pulses between triggers. I need to have a hardware-timed digital signal which goes from low to high if there are ever more than n pulses between trigger changing state from low to high. 
    What I am planning to do is this: 
    Wire 'trigger' to the z-input of the quadrature encoder, and set the z-input value to some arbitrary large value such that, at the quadrature encoder counter task's settings, the counter reaches terminal count in n pulses.
    Configure the quadrature encoder counter using DAQmx Export Signal Property Node (tutorial I was looking at is here: http://zone.ni.com/devzone/cda/tut/p/id/5387 ) to toggle a digital channel ('counter event output') from low to high if the counter reaches terminal count (ie, if the encoder reads n pulses).
    If the encoder ever reads n pulses on 'clock' between two rising pulses on 'trigger', it sets counter event output high.
    Is this possible? Reading through the manual of M series PCI-62xx devices, the index pulse loads the counter with a particular value so it seems like you could conceivably set the counter to the terminal count if you wanted. My only real problem is whether DAQmx Export Signal Property Node works on all counter tasks or just on edge counting tasks. 
    Thanks in advance for your help. If this isn't possible, I can reply with more details on the problem this is supposed to solve so that you can help me figure out an alternate method.
    Solved!
    Go to Solution.

    There is probably a way to do it, but it it may be easier to use an X-series board for the job.   They support a new counter capability for count reset on a digital edge without needing to be configured in encoder position mode.  I am not sure exactly how that feature's been implemented however, so maybe it won't make things easier after all.
    The plan based on the hoped-for behavior: 
    1. Configure an X-series counter for pulse generation based on "ticks" of your clock channel.
    2. Set both initial delay and low time to the critical # of ticks.
    3. Configure for count reset on a digital edge (if possible in pulse generation mode)
    4. Configure the count reset value to be the critical # (or possibly 1 less, if possible in pulse generation mode)
    5. If you want the output to remain high indefinitely, configure the counter task to use its own output as a
    pause trigger, and pause while high.
    The way pulse generation works is to preload a # of "low time" ticks into the count register.  Then every source edge will decrement the count.  When the count reaches terminal count (0), the counter's output is toggled (or can be configured to pulse).  The register is then loaded with the # of "high time" ticks and the process continues.
    You would be perpetually interrupting the count-down process as long as you got your triggers in time.  The count would keep getting reset to the # of low counts, keep decrementing toward 0 without reaching it, and so on.  If ever you did reach 0, the output state would toggle high, then the high state would prevent subsequent clock signals from decrementing the count.
    You can conceivably do a similar thing with a 6601, but I'm pretty sure you'd need 2 counters working together to get it working.
    -Kevin P

  • Quadrature encoder frequency division dotNet Net VB C#

    Hello,
    following a long search on this forum, I have decided to start this thread for dotNet developper.
    I have a PCI-6602 with a quadrature encoder (A,B,Z). The pulse frequency is average (10kHz).
    I am only using A and B channels.
    The function I have to implement is to generate an output every N pulses in the forward direction. N being an integer and ranging from 1 to let say 100.
    I have no constraint on the output. I am it can be a bit toggling or a pulse generation.
    What functions shall I call in MeasurementStudio.Net to implement this ?
    How many counters should I use ?
    On the register basis, my guess is that I have to pre-load a value in the register.
    Then when downcounting the counter reaches 0 this in turn does 2 things:
    reloads the counter to its preset value
    triggers the output generation (TerminalCount)
    Thanks for any help you may bring 
    NOTEs FOR NI guys:
    By the way, in the NI samples, quadrature doesn't work all the way.  I nthe sample  "CountDigEvents" with CountDirection set to "Externally controlled",  backward motion is never displayed. This is because the counter is read as a UInt32.
    Solved!
    Go to Solution.

    Hi,
    Your first ideas are pretty good, it should be a good way to implement a solution for your problematic.
    I am not used to work with MeasurementStudio, but this is few links which you could use or which could help you with theoretical points:
    http://zone.ni.com/devzone/cda/tut/p/id/3167
    <link no longer exists>
    http://zone.ni.com/devzone/cda/epd/p/id/2999#0requirements
    Hope it could help
    Mathieu B
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Forum Aéronautique, Spatial et Défense. Avec la participation exceptionnelle de Bernard DUPRIEU, Res...

  • Quadrature Encoder measurements with PXI-6143 S-Series DAQ

    Has anyone used a S-series PXI-6143 DAQ to take encoder position measurements? I believe there are 2 counters available, if you have any examples of how to access and read from these counters it would be greatly appreciated.

    Hi Bentup,
    Measuring a quadrature encoder on your device is actually going to be a bit different than on an M series device.  The STC-2 chip, which is used in the M series, allows for A and B inputs specifically for encoder signals (used in the Angular Encoder task).  The original STC-1 chip which is used in E series and most S series boards (including your 6143) does not have these same inputs.  Instead, you may must a Count Digital Events task (taking advantage of the up/down line of the counter).  The Angular Encoder task is not supported on STC-1 devices.
    The article that lab_boy linked earlier actually mentions how to use an encoder with an E series device once you scroll down a bit (here's the link again).  This same procedure should apply to your S series--connect the A output of your encoder to the source of the Counter (this is the signal that you are counting).  Connect B to the up/down line of the counter (P0.6 and P0.7 for counter 0 and 1 respectively). 
    The downside with this method is that it is more susceptible to vibrations or noise on the encoder lines. If this is a problem for you, you can look into an external encoder conditioner like the one mentioned in the article.  I hope this helps!
    Best Regards,
    John
    John Passiak

  • Speeding up quadrature encoder read out

    Hi,
    I`m using a quadrature encoder together with a 6259 DAQ Card and BNC2110 Terminal Block.
    I managed to have it working with the DAQ-Assistent at 80Mhz using the Counters and reading one value at a time. Before the DAQ-Assistent I used a DAQmx command to connect PFI10 and PFI9 as the BNC2110 Terminal only outputs PFI0-9. This works but it is really slow, the distance between each measurement point is around 6 us. The VI is in the attachement (AquadB_one_value.vi)
    So I thought I might use the n-values version with the DAQ-Assistent but this does not work and I dont see any reason why, it is complaining about that connection between PFI10 and PFI9 which it didnt do before in the one-value-version. The VI is also in the attachement (AquadB_n_values.vi)
    I also tried another method using a VI I was given some time ago and modified it but here the distance between each measurement point is also around 6us. This VI is also in the attachement (Counter - Read Encoder.vi)
    Or am I missunderstanding something? The minimum achievable time distance between measurement points should be 1/80.000.000 s where of course the value can only differ 1/0/-1 because it has only calculated one new change in the A and B Signals right? I thought with using the n-values it is storing all the calculated values in the memory and I am transferring them afterwards for doing all the "post-processing"?
    If I am wrong, how can I spped up the read-out of the calculated values any other way?
    Best regards
    Attachments:
    AquadB_n_values.vi ‏56 KB
    AquadB_one_value.vi ‏49 KB
    Counter - Read Encoder.vi ‏98 KB

    Hi Dani_munich,
    I just realized that you asked the same question in our Service request. In the service request, I was missing out more information which I found them here by chance . I will further assist you in the SRQ you have created. I also sent you an email.
    Regard
    Anoj
    Anoj Mubarak
    National Instruments

  • Quadrature encoder counter with 8 channels

    Hi,
    I need to acquire the signals (A and B) of four quadrature encoders. The signals have a maximum frequency of about 5kHz and should be read out with about 100 Hz. Is there a device that fulfils these requirements? It seems that a frequency of 5kHz is no problem since e.g. the USB-6008 has a counter for frequencies up to 1 MHz. However, I can't find a simple low-cost device that provides several counters. Does anyone know such a device with 4 or 8 counters?
    No other analog or digital channels are necessary, but a USB connection and Matlab support would be ideal.
    Thanks in advance.

    Depending on your definition of low-cost, the 9171+9401 might suit your needs:
    4 counters capable of quadrature encoder measurements (the single counter on the 6008 only does simple edge counting).
    USB connection.
    MATLAB support via the Data Acquisition Toolbox (according to their website).
    I don't believe NI currently has any other option that meets these requirements at a lower cost.  If USB isn't mandatory, you could also consider the PCIe-6612 which provides 8 counters.
    Best Regards,
    John Passiak

  • Measuring distance using quadrature encoder

    I am currently doing a project that requires the positioning and characterization of TV signals. As such, the position of the TV receiver is one  important variable that i have to measure. I am required to automate the measurements and data logging using a PC/notebook. I have purchased a 2-channel HEDS-9000 quadrature encoder with 2000 CPR & the HEDS6120 codewheel - both from Avago Tech, to be interfaced with the notebook/PC. My idea is to get a TTL-to-RS232-to-USB converter to interface with the PC, so that i can feed the output from the encoder to the PC. However, i dun have much idea on how I can use LabView to interface the encoder and the PC. Can anyone offer some valuable advice?
    Btw, the encoder module consists of 5 pins - Vcc, GND, CH.A, CH.B, with one pin not used.
    Thanks !!

    Hi,
    I think one of the best and reliable options that should meet your needs is a bus-powered USB-M-Series device like the USB-6210.
    The USB-6210 is a multifunction data acquisition device with 16 analog inputs, 4 digital inputs, 4 digital outputs and 2 counters. Each of the counters can interface directly to the quadrature encoder signals of your HEDS-9000.
    It's very easy to use this device with the NI-DAQmx API for position measurements in LabVIEW. In fact there are some shipping examples that you can use for getting started.
    I hope this helps,
    Jochen Klier
    National Instruments Germany
    Message Edited by Jochen on 02-09-2007 09:18 AM

  • Generate a pulse train using a count from a quadrature encoder as the clock

    I am trying to generate a pulse train with the same frequency as my quadrature encoder.  Every time the encoder counts, I want the pulse to go high until the next count and then go low and so on.  I am using a 6602 PCI card and a BNC 2121 accessory.

    Maybe I'm not understanding your app, but I *think* you and I are approaching it from two very different directions.
    As I understand it, you'd like to emit a pulse with each quad state change.  Then that pulse would act as a counter Source signal.  The counter will then increment on each pulse, to keep track of accumulated position.  Further, you'd use your device-under-test (DUT) as a counter Gate signal, which would buffer the position count each time there's a rising edge on your DUT.  The end result is a buffer of position values, captured at each rising edge of your DUT.
    I'm talking about a different approach to produce the same data.  You'd use 2 tasks on a M-series board.  One of them is a hardware-timed digital input task based on "change detection."  Each time one of the specified bits has a transition, your whole set of digital input bits can be captured and an internal "change detect pulse" is generated on the board.  This task should be sensitive to the DUT edges.
    The other task would be a buffered position measurement.  It would receive the reference encoder inputs and internally do quad decode and keep a running count.  The sampling clock for this task would be specified as the other task's "change detect pulse."
    Net result: on each specified edge of your DUT, you'll buffer a reference encoder position value and a digital state of your DUT.  You can choose to be sensitive to rising edges, falling edges, or (!!!!) both at once. You can also choose to be sensitive to many bits simultaneously.  These are better capabilities than you get with the 6602 alone.
    I *think* the 6220 should be ok, based on a quick overview of specs.  I assume your 3.6 MHz is the rate of ref encoder quad state changes, right?  In the approach I'm suggesting, you only need concern yourself with the rate of DUT edges which appear to be in the 10's of kHz or less.
    Gotta go for now.  Post back if any further questions.
    -Kevin P.

  • Does Stop task reset a quadrature encoder counter?

    I am using an M-Series PCI-6280 board, with one of its onboard counters wired as a quadrature encoder.
    1)I start the counter task, take a set of measurements with the counter, and then stop the task.
    2) The encoder which the encoder counter is monitoring continues to output quadrature encoder signals into the PCI board's counter.
    3) I start the task again, and perform another set of measurements.
    Which of the following occurs?
    Upon starting the task again, the counter's previous value was wiped and the measurements taken in (3) start at 0 counts. 
    The counter keeps the value it had before it was stopped and subsequently started, and the measurements in (3) cumulate on top of the measurements taken in (1). 
    The counter keeps the value it had before it was stopped, continues to increment/decrement position in (2) even after the task is stopped, and when the task is started in (3) the counter value is cumulative with the quadrature encoder pulses in (1) and (2). 
    Thanks in advance for the help. 
    Solved!
    Go to Solution.

    Hello acmap,
    In this case The behavior will be the following:
    Upon starting the task again, the counter's previous value was wiped and the measurements taken in (3) start at 0 counts.
    However, you can specify the initial count value of the counter on the Initial Count terminal of the DAQmx Start Task VI, so it doesn't have to start at zero, and you can implement the behavior described in your second option.
    Daniel

  • How to route Quadrature Encoder signal to CC1 using PCIe 1429 + IO extension card

    Hi there,
    i am currently trying to interface the Basler L304kc to the NI PCIe 1429 + Cameralink IO extension board
    I want to operate the camera in Ex-SYNC level controlled mode. I would like to route external Quadrature Encoder signals (connected to the IO extension board) to the CC1 cameralink control of the camera
    Currently, I cannot find this option either in MAX or the Camera File Generator.The L304kc camera file only provides pre-defined pulses, or MAX only offers "External","ISO","RSTI" options for the CC1 sources.
    Is it possible to route the encoder signal from the IO extension board directly to the CC1 of the camera? Or is there a work-around?
    Thanks!
    Derek Chan
    Application Engineer
    Basler Asia Pte Ltd

    Hi Alex,
    I posted the following (similar) text to the support center but I think it is of common interest:
    A) CL-card with ext. board. One can use the ISO, ext. and RS422 encoder inputs and also output cannels ISO and external.
    There is also a SMB connector corresponding to the ext. channel 0.
    B) with MAX one can define what kind of signals should be routed to CC1 to CC4. As I learned from
    this side one cannot use MAX or the Camera File generator but has to do this manually in order to use RS422 encoder triggering!!!
    C) on the other side there exists function to route and control signals explicitely, for example
    * imgSessionLineTrigSource2 -> what is this good for then? All your manuals are saying that this is done in MAX or the camera file by defining what signal drives the correspondung CC ine?? On the other side there is an example in CVI that does not work ("Trigger Each Line From Encoder") (at least it does not work with the PCIe1430).
    D) Can one implement the CC routing from MAX or the camera file manually with the following functions
    * imgSessionLineTrigSource2
    * imgPulseCreate2
    * imgSessionTriggerDrive2
    or does MAX use hidden functions ore mechanism to control the CL Cards?
    E) I can use one single line to setup scaled encoder triggering
    * imgSessionLineTrigSource2(iLS_ZK1_SessionID, IMG_SIGNAL_SCALED_ENCODER, 0, IMG_TRIG_POLAR_ACTIVEH, 0);
    but this only starts to work if I reset the encoder position to zero by sending this to the CL card, i.e.
    * imgEncoderResetPosition(SessionID);
    AND only in positive counting direction!
     If I just run though the zero position without a position reset I do not get ExSync on CC1????
    Is the information where to route the Scaled encoder to coming from the camera file? Why cannot I simply and explicitely route the scaled encoder
    signal to a certain CC line? Why using all those different approaches?
    F) now if in addition to E) i use
    * imgSessionTriggerDrive2(iLS_ZK1_SessionID, IMG_SIGNAL_EXTERNAL, 0, IMG_TRIG_POLAR_ACTIVEH, IMG_TRIG_DRIVE_SCALED_ENCODER);
    to drive ext. 0 (SMB connector) I can see exactly this behavior on the scope. No signal until I reset the encoder counter. Then I get signals as long as the image sequence is running. After the recording the signal disappears.
    kind regards, Holger h.baur(at)ivisso.com

  • Quadrature encoder read

    Hi.
    I'm a new user to labview, so try to be as soft as possible.
    I want to control an electric motor(24v, 3I) via labview.
    I use labview 6i(budget,budget) and a pci6024e board.
    I have a quadrature encoder connected to the motor and I've build
    the pid vi to control it.
    1.what is the best way to connect the encoder?
    i have tried to use software counters, with no luck so far.
    2. I need to find a way to build a vi that can give me the response of a known transfer function to a pulse.is there a vi example or do I need to build it by solving the DE?
    Thank you
    ran

    Hi Ran,
    There are a few examples of either counting digital pulses on your quadrature encoder, or measuring the revolution frequency (frequency measurement). Depending on your application you will need to connect your device to your E series card to either the gate (frequency, period and time measurements) or the source (simple event counting) of the counters. These are decribed clearly in the E Series Help File. http://digital.ni.com/manuals.nsf/websearch/0E0DFDBB7706687A86256F6300560584?OpenDocument&node=10968_US
    In addition, we have a few examples and tutorials on this website. You can simply make quick searches with the few key words i have just mentionned.
    You also have to make sure that the signal coming out of your encoder is in the appropriate format (5V digital). In some cases, you would need a voltage divider.
    As for the second question, I would need some clarification. You can definately process the information you have acquired in any way you want. You can search for our VIs by selecting the search button in the function pallette. Most data processing VIs are for analog signals.
    Best regards,
    Nathan Yang
    Applications Engineer
    National Instruments

  • How to calibrate Quadrature Encoder signal

    I have PCI-6601 and CB68-LP connector. How can I use these to interpret quadrature signals coming off an optical encoder (to sense the angular position of an-observatory dome). The encoder is 16-bit(don't know what this means in terms of PPR). I want to have a display in Labview that will show me the position of the dome in a fraction of 360 degrees with some reference(true north?), the dome rotation controlled by a three way switch(clockwise-off-anti-clockwise). I don't have much experience with labview and any help will be appreciated.

    If the encoder is 16 bit then it would seem that: -
    360/65536 = 0.0054931640625° or there abouts.
    You can break the project down into two halves nicely.
    1) Hardware interfacing.
    2) Software read out.
    The hardware interfacing means two basic things:
    1.1 What is the encoding technique
    1.2 How are the signals conditioned for output to an external device.
    The software is classic:
    2.1 Input
    2.2 Process
    2.3 Output
    The optical encoder could be one of a few types and you need to understand both the signalling / interface and the coding technique to progress further. A good start will be the manufacturers data sheet for the product. Contact the manufacturer.
    Once you understand the coding technique you will then know if the unit is absolute or relati
    ve. This will then allow you to determine how you can point to true north (easily with an absolute encoder, it always tells you exactly where it is).
    If it is a classic quadrature encoder then the relative phase of the reference and movement signals gives you direction. Counting transitions gives you realtive movement. But if the power went off on the PC. you don't know where you are unless you go to a home position! That could be 359° round !!!
    Good Luck

  • Using a Quadrature Encoder as a clock at best precision possible

    I would like to use a Quadrature encoder as a clock for analog data acquisition. Currently, I am using only one line of the encoder and the clock "ticks" when the line goes high. This is only one quarter of the precision the quatrature encoder is capable of, since it can count from both lines when they go either high or low. I was wondering if I can get the counter to send a pulse everytime it increments and use that pulse train as my clock. This would increase my analog data acquisition frequency four fold.

    Hello,
    It is not going to be possible to count both rising and falling edges with a single counter. You could route the A phase and B phase of your encoder to different counters to capture the different edges on the signals, but that will not help you in using this encoder as your clock source. What you may want to invest in is a quadrature clock converter. You can find more information on this at the following tutorial:
    Using Quadrature Encoders with E Series DAQ Boards
    Best,
    Jared A

Maybe you are looking for