Reset clock count/encoder counts

Is there a way to programatically reset the clock count using labview? I am using an encoder and an e series DAQ board. When I am counting with the encoder, I come to a point where I would like to reset it to zero. I see that the examples all show that the count is reset after the loop is complete, but I would like to reset it during the loop to use it as a positioning tool. Reset to zero then start counting again from that point. Is this possible? Thanks.
Using Labview 6.1 and MIO16E DAQ Board.

Use the "Counter Control.vi" (Data Acquesition-> Counter->Advanced Counter). With the control code 1 you can resets the counter. Alternatively you may use the VI with control codes 4 and 2 which disarms and arms the counter again ("If you follow a disarm with another arm, then the acquisition restarts from the beginning"). That should do.

Similar Messages

  • 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

  • Need to use quadrature encoder to trigger (RTSI) single point DAQ on 2 channels of E-Series DAQ, using 6602 NI-TIO for counting encoder pulses.

    This is for LV6i, W2000, all PCI equipment.
    Using a quadrature-measure position-VI, I get 7200 edges/rev from the encoder of my physical system. This equates to 0.05 degrees of angular displacement. This amounts to an angle stamp as opposed to a time stamp.
    I need each of these 7200 edges (source: 6602 NI-TIO) to trigger (using RTSI) the acquisition of a single sample from each of 2 channels on an E-Series DAQ board (maybe more channels later). I only need/want one rev (7200 samples per channel) of data for each run of the test. As I write this I think I want pre-triggering and a little more than a rev of data. So the
    re is a buffering step. Anyway, you can get the idea.
    I need this angle stamp and the DAQ samples to be placed in an array and on the hard drive for graphing and other mathematical treatment, analysis, etc.
    I think there must be a way to use the quadrature output of the counter/timer as a scan clock for the DAQ board, but I haven't seen an example to guide me.
    It seems like all of the RTSI or other triggering examples I have seen trigger once to start a continuous scan, not a series of discrete samples repeated quickly. I am not sure how to fill an array with this data. Again, examples are for continuous sampling, not a series of discrete readings.
    Any hints on any part of this task will greatly appreciated. This is my first LV project.

    Sounds like a fairly ambitious first project!
    I assume your 7200 edges/rev come from an encoder with 2 channels in quadrature which each provide 1800 cycles/rev. You can clock in analog data at 1800 scans/rev with either of the two encoder channels, but will probably need an external quadrature decoder circuit to produce 7200 scans/rev. Either method can be done with screwdriver and wire or else by using another counter from the 6602 and the RTSI bus. Here are two approaches in detail, but you could mix-and-match as needed.
    Note also that if you can be sure that your reference encoder will be uni-directional, you wouldn't need to measure position -- position could be determined by the array index of the analog scan data. This would simplify things greatly.
    1800 scans/rev, screwdriver & wire
    Wire both encoder channels to your 6602 breakout box and configure your counter for the 4x quadrature option. Send a wire from one of the encoder channel connections at your 6602 breakout box to a PFI pin at your E-series board breakout box. Config the analog acquisition to use an external scan clock and specify the correct PFI pin -- there are built-in examples that will guide you. Now one edge of one encoder channel acts as a scan clock for your analog acquisition. Inside the 6602 breakout box, route the same signal to one of the default gate pins and configure your encoder counter gate to use that pin as its gate signal. Note that there will be a race condition governing whether the encoder value updates from the encoder inputs before or after the value is latched by the gate.
    7200 scans/rev, extra counter & RTSI
    Make sure you have a RTSI connector between your two acquisition boards inside your PC. Build a quadrature decoder circuit that will convert your two encoder channels into a clock and direction output. (Consider the LSI 7084 decoder chip or similar). Setup your "encoder" counter for buffered position measurement. Use "Counter Set Attribute" to define "up down" as "digital" (don't use it to define "encoder type"). The clock output goes to the counter SOURCE and the direction output goes to the counter UP_DOWN pin.
    Use "Adjacent Counters.vi" to identify the counter considered adjacent to your encoder counter. Configure it for "retriggerable pulse generation". Use "Counter Gate (NI-TIO).vi" to specify "other counter source" as the gating signal. Configure the output pulse specs to be short duration (make sure total of delay + pulse width is less than the minimum period of the incoming encoder clock signals). Use "Route Signal.vi" to send this counter's output onto the RTSI bus, say RTSI 0.
    Now configure the analog acq. to use RTSI 0 as its external scan clock. Also configure the encoder counter to use RTSI 0 as its gate signal. Voila! Now your quadrature decoder clock output acts as a scan clock for analog acquisition and a "gate" to buffer your encoder measurement. The short delay helps ensure that the clock updates the position measurement before the gate fires to latch the value.
    Respond if you need clearer explanation. There's a fair amount of decent info "out there" if you scour the online help and this website. Good luck!

  • Can PCI-6601 pulse signal over RTSI every Nth encoder count?

    Hi All,
    I have a PCI-6601 counter/timer connected to a quadrature angular encoder.   The 6601 is also connected to a PCI-1422 frame grabber with a RTSI cable.
    I want to be able to trigger the frame grabber by sending a pulse over the RTSI cable every N encoder counts (or X degrees).
    How would I go about do this using C++?
    Thanks in advance,
    Brad 

    Hi Brad,
              There are a few resources I think you may find helpful.  First, there's this DevZone article, " Generate and output pulse every no count an encoder traverses".  Generally, the way this would work is:
    If you want to output a pulse every 4 counts, you will need to take the
    total count size of the counter (2^32 bits) and subtract 4 from this.
    This will be the initial count to set, so that after 4 counts, the
    counter will reach Terminal Count and the Counter Output Event pulse
    will be fired. You can then export the Counter Output Event to a PFI
    line, and use this line as the Z index terminal. If you set the Z index
    value to be equal to the initial count, the counter will always reset
    to 4 ticks below the Terminal Count, and will output a pulse on every
    4th tick. The only drawback to this method is that it will require that
    only X1 decoding be used, and that the counter would have to be
    dedicated to sending out the Counter Output Event (if you want to
    actually count the encoder and keep track of position, another counter
    will have to be used).
    As for specifically doing this in C++, I would recommend referencing the DAQmx C Reference Help (Start»All Programs»National Instruments»NI-DAQ»Text Based Code Support»DAQmx C Reference Help).  Hope that helps, for more assistance on the frame grabber portion of your question, I would reference the post you put in the vision forum.  Have a great day! 
    aNItaB
    Applications Engineer
    National Instruments
    Digital Multimeters

  • Need help for encoder count program !!!!!!!!!

    I am a new labview user.
    And i am trying to complete a project for my course.
    For a quick background on what I am working with, I am using a NI PCI-73566-Axis Stepper/Servo Motion Controller for PCI, NI UMI-7764 Series, NI USB-6009 and a IDEC SC1B Rotary Encoder.
    I am try to design a encoder count program and a new program to convert the encoder signal to RPM.
    But I just don't know where should I start? How can I get the same block diagram like P11 in the attach file?
    Please check more detail from the attach file.
    Attachments:
    P11.jpg ‏127 KB
    P8.jpg ‏149 KB
    P15.jpg ‏141 KB

    Hello,
    The two objects on the block diagram are DAQ Assistants and can be found under Functions»Measurement I/O»NI-DAQmx. From what I can gather, this is acquirign signals that you should have connected to the USB-6009.
    -Zach
    Certified LabVIEW Developer

  • Using AI Sample Clock to Trigger Counter Samples

    My basic question is:  Is the ai\SampleClock signal only active while an analog input task is running?
    The details are:
    I have an X-series PCIe-6321 multifunction DAQ card.  It is controlling a SCXI chassis and has a SCXI-1180 and SCXI-1302 so I can control analog inputs of the chassis as well as access the 4 counter  on the card.  My application requires that I use all 4 counters to measure a frequency input signal and synchronize the samples to the analog input signals.  I have created 5 tasks, 1 for the AI and 1 for each counter.
    I am using LabVIEW 8.6.1 with the latest NI-DAQ drivers on and 64-bit Vista OS 
    1. Are there any driver or hardware restrictions that would cause this solution not to work? 
    2. Can I use the ai\SampleClock as in input sample clock for each of the frequency tasks?  If I do this will the sampling start be syncronized?  I.e. if I start each of the frequency tasks first, will they wait until the AI task is started before they start sampling?
    3. If that doesn't work, do I need to route the sample clock from the AI task to a PFI line (PFI1) and then use that as input to the frequency task sample clock? 
    I usually do option 3 when synchronizing two cards in  PXI chassis and only use the software task start in stead of of synchronizing on a digital start, since the sample clock will control the samples anyway.  I need to know if the same behaviour works with the scenario above.
    Thanks,
    Bob
    Prolucid Technolgies Inc. 
    Solved!
    Go to Solution.

    Hi Bob,
    I can confirm that the ai/SampleClock will only be active while the AI task is running.  As far as the other questions go:
    1.  You'd have to provide more information about what you looking to do exactly, but there is no problem with routing the sample clock of the Analog Input task to be used with the Counters.  I would read through the section of the X Series User Manual that discusses sample-clocked frequency measurements (starting on page 7-16) for some more information about what is actually going on during this configuration to make sure it suits your requirements. 
    The frequency of the signal to be measured should be at least twice as fast as the sample clock of your AI task.
    2.   You can indeed route the signal to all four tasks at the same time (you can refer to the Device Routes page in MAX to double-check routing restrictions).  The sampling will be synchronized provided the four counters are started before the AI task, but the counters will be armed at different times unless you configure an Arm Start Trigger (see page 7-45 of the X Series User Manual).  I would consider using the ai/StartTrigger if you wish to do this. 
    The effect of not arming the counters at the same time would be a different number of periods to average on each counter for the very first sample (assuming averaging is enabled).  This might not be a big concern but I just wanted to point it out.
    3.  The routes are available internal to the board so external routing isn't necessary, you can just specify to use the AI Sample clock for the clock of each counter and the routes will be made for you.  If you prefer to export the signal on a PFI line and route it back in on a different PFI line this option is also available to you but shouldn't be necessary.
    I hope this helps you get started.  I'd make sure to take a look at chapter 7 of the X Series User Manual if you get a chance since it describes how all of the counter configurations work in more detail.  If you have any related questions don't hesitate to post back.
    Best Regards,
    John
    Message Edited by John P on 12-01-2009 07:52 PM
    John Passiak

  • Encoder counts to controller - error

    Hello everyone,
    Could someone please help me with this LabVIEW program? I thought I was near complete with finishing up this project, but have encountered problems while executing the program with hardware. I am under a very close deadline, so any tips or advice is very much appreciated. 
    About the program:
    I have a sub panel that represents an x-y stage where a mouse cursor navigates about. The x-y stage is controlled by two actuators, and a mouse cursor's movement within the subpanel will allow for the actuators to move about.
    There are three different cases (case structure):
    0: Do nothing
    1: Update mouse coordinates (x & y coordinates are displayed in boxes titled "Local Mouse Coord")
    2: Display absolute position (x & y coordinates are displayed in boxes titled "Encoder counts")
    My program currently works so that the mouse coordinates (in pixels) are updated and displayed ONLY when the cursor is within the panel's bounds. I did this by implementing the In Range and Coerce Function.  
    Screenshots of my current sub panel and block diagram are in the attachments below. 
    (Note: Coord to Encoder on the Front Panel is supposed to be at 500 to attain encoder counts) 
    I have two axes where one axis represents x and one axis represents y. These axes are controlled by actuators connected a Newport MM3000 Motion Controller. 
    Once I had my program running and the controller was turned on, the program would only execute partially for Case 2 (encoder counts). 
    Moving the mouse cursor up and down within the subpanel allowed for some movement on the actuator for axis 1 
    Moving the mourse cursor left, right, and diagnol caused an error on the controller called "Bad Command"; there was no movement on the actuator
    Below is a zoomed in version of my Case 2: 
    The front panel and block diagram for "IEEE Write" is below: 
    As you can see in the front panel of IEEE write, 1pa1000 represents a command that will move the actuators to absolute position, where 1 represents the axis number and 1000 represents the absolute position destination (in encoder counts). 
    I know that no one will probably be able to implement this without the hardware. However, if anyone has dealt with similar issues before, could you please lend me a guiding hand?
    I just need to know what I could do to modify my code to elminate the "Bad Command" I am getting from the controller. 
    Many thanks in advance! 
    Attachments:
    Screen Shot 2012-11-08 at 8.12.01 PM.png ‏105 KB
    Screen Shot 2012-11-08 at 8.14.37 PM.png ‏104 KB

    qpt,
    I would definitely recommend contacting the manufacturers of your Newport MM3000 Motion Controller to check and make sure the commands and the command protocol that you are sending the device are compatible with the controller. They might have some more insight as to why you are recieving this error. 
    Regards,
    Leah
    Regards,
    Leah
    National Instruments
    Applications Engineer

  • Help! To design a counter for counting clocks

    Dear all,
    I want to design a counter that count all clocks of a square wave. I have tried but I am getting stuck somewhere. Here's attached the file that I started. In this project, my objective is to use NI-USB-6008 to send a square wave to an external oscilloscope. That square wave has to be self-controlled such that nth first clocks have  a certain frequency different to the next (n+1, .....,m) clocks. As part of that, I need to use a counter that I designed myself.
    Actually, I have the C++ codes for that:
    int count=0;
    if(result==1)
    count++;
    This is just the section that I want
    Attachments:
    DigOutFuncAuto.vi ‏180 KB

    Hello,
    I am a bit confused about your application, are you trying to count (input) clock edges or generate a clock signal with your 6008. If you want to count digital edges with the USB-6008 you can use the counter on the 6008 to count these edges; an example in the example finder exists already and can be found in the location shown below. If you want to generate this varying clock signal, it will be difficult with a USB-6008 since it software timed and updates to the digital line will depend on the updates over the USB bus. If you can clarify your application a bit, I may be able to make some suggestions.
    Eric
    Eric Liauw
    AE Specialist - Automated Test | CLD | CTD
    National Instruments

  • How do you convert the encoder counts to RMP of the motor using a myRIO in LabVIEW?

    My intent is to gain hardware interfacing and general Labview experience. I am using a myRIO to control a Pittman 8222 34V Brushed DC motor (Motor Specs).
    I recently created a code to control the angle of this motor using PID, which was visually implemented using the black disc with a white tick mark on it (see attached picture: "IMG_2523"). 
    I now want to control the speed of this motor againg using PID, but I am not sure how to properly convert the encoder counts to RPM of this motor. I have attached 2 screen shots of my block diagram and my front panel for reference ("Capture" and "Capture2"). In the front panel picture, you can see my "actual" speed of the motor is a very choppy signal when it should theoretically be a flat line. To get the RPM, I currently use a shift register to store the current count value (which I converted to deg, then to radians), and then subtract the previous run's value, then divide by the while loop sampling time (10 ms). This would give me rad/s, which I then wrote a subVI to convert it to rpm. 
    Any help would be greatly appreciated, thanks. 

    Hi,
    One thing you could try doing is verifying that the conversion from rad/s to rpm is working correctly. 
    This tutorial might also be helpful. It's not using the same hardware that you are, but goes through the general steps using PID control. 
    CompactRIO Motor Control Basics Tutorial: http://www.ni.com/pdf/labview/us/compactrio_motor_control_basics.pdf
     

  • Encoder counts wrong after Firmware update to 7.2?

    Hi,
    I recently updated the firmware of my motion controller card 7344 PCI to 7.2.
    Since then a 360degree-rotation in 15degrees-steps seems to miss one 15degree-step. A 360degree-rotation stopps at 345degrees
    I think that maybe the encoder counts wrong or the move function isn't executed one time.
    Has anybody expierienced similar problems or has any hints?
    Thx.
    PS. Does anybody know a way to downgrade the firmware to the version below? It seems that the firmware update causes the problem.

    saimen54,
    Odd behavior.  Is there anyway you could post the code for a simplified version of your program that exhibits this same issue.  I don't think there will be any other way to troubleshoot your issue without taking a look at the code.
    Thanks,
    Lorne Hengst
    Application Engineer
    National Instruments

  • Camparing encoder count

    hi
    I am reading an encoder and counting the pulses, with a display value which updates every 100ms.
     After a certain interval, the encoder count stops incrementing.
    How can I save the encoder count at one  instant and compare with the count after an interval passes(e.g. 1 second )  to determine when the count stops increasing?

    make a ringbuffer with
    a) a subvi see example somewhere in XY-Graph
    b) a queue
    c) if you have LV-RT using the RT-FIFO
    another way is attached
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    nochange01.vi ‏40 KB

  • Will resetting the MBP also reset the battery cycle count?

    Hi All,
    I recently purchased a used MBPR (Late 2012) model.
    When checking the battery cycle count, I noticed that it says 2.
    I am not sure if the original user ever reset the computer, since I noticed he left couple personal files on the computer when it arrived.
    I was wondering if anyone can tell me if resetting the Macbook Pro to factory setting well also reset the battery cycle count.
    Thanks,

    Welcome to Apple Support Communities
    If you reset the MacBook to factory settings, battery cycle count stays as it was before. Note that you have the same battery, so the only way to reset the battery cycle count is to install another battery

  • Read "Encoder counts per revolution" in Labview

    Hello,
    I have set up an 'NI Motion Device' in the Measurement & Automation Explorer.  I would like to read the value of 'Encoder counts per revolution' in labview.
    I do not want to re-enter the value of 'Encoder counts per revolution' in my labview code;  I would like to write the value once (in the Measurement and Automation explorer), and then have labview read this value.
    How does labview access this value?
    Regards,
    Myles

    After speaking with a few different applications engineers at NI (see ref#2042315), the 'NI Motion' module only supports setting the counts per revolution (not reading them).  The 'NI SoftMotion' module allows for the reading of "Encoder Counts per Unit' under the softmotion property node.

  • Using External Clock to write counter value to buffer

    Using CTR mode config which input controls at what frequency the counter value gets written to the buffer? How do I set it up so the counter value is written to the buffer at the same time Anologue inputs are written to a buffer, without using the other counter.

    Hello,
    Could you please explain what type of counter operation are you interested in doing? That would help me in suggesting something.
    But if I roughly understand what you are saying here, you can use a same clock to provide as scan clock for analog input and then use that clock for the counter. But depending on what counter operation you are trying to do will decide whether that clock be provided as source or Gate.
    You may take a look at examples provided at the following location too :
    Measurement Hardware
    Sincerely
    Sastry V
    Applications Engineer
    National Instruments

  • What is the difference between count(*) and count(1)

    what is the difference between count(*) and count(1)

    Hi,
    903830 wrote:
    some say count(1) is faster and some say count(*), i am confused about count function?In the link provided by Prakash :
    prakash wrote:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1156159920245
    You can read :
    Followup   August 31, 2001 :
    I'll have to guess, since you don't say, that you are using 7.x and before when count(*) and count(1) were different (and count(1) was slower). In all releases of the databases for the last 4-5 years, they are the same.
    Don't waste your time on that.
    ;-)

Maybe you are looking for

  • My Ipod is in disk mode how do i undo this? help!!!!!!

    I have a Ipod nano 2 generation. How do i undo disk mode??Help! My Xp says that the ipod needs to be reformatted and my itunes wont open someone please help me please! Message was edited by: Dont no what this is

  • Command prompt appearing on several machine after install ?

    I have several machines running intune now, some previously GFI and before that eset, but this is also occurring on new clients, every now and then a command prompt window is opening up and closing very quickly the only thing I can pinpoint is intune

  • PHP photo galleries that are compatible with iPhoto?

    I don't have MobileMe, but I do have a personal web site running PHP and would like to publish my photo albums on my web site as a good place to store them. Does anyone have any recommendations for the best PHP photo gallery software (preferably free

  • My archive zip's stopped working...

    Everytime I try to make an archive of something it comes up with an error message of "The archive's list of contents cannot be created" HELP!... It worked fine before and now I can't compress anything

  • Re: Restricted Libraries Gone Wild....

    I restricted all 3gl libraries so that they would be locked into their required platforms. I insulated the restricted components from the rest of the application with service objects which are not restricted. All objects returned, or passed out of th