DAQmx counter rollback

Hi
We developped a VCD in order to measure the speed of a motor. To measure this speed, we use some counter.
We use the Daqmx Create Channel function (CI Position angular Encoder) , and then we read the angular position using the DAqmx Read (counter dbl 1channel 1 sample).  Then we calculate the speed with the angular position difference and the time difference between two calls.
All this things works, but after a while (depending on the speed of the motor) , we have a rollback of the counter and then a false speed measurement. It is normal to have a rollback, but why isn't this rollback managed by NI when we use the angular position. The driver returns me a angle position, it should return me the good position even if i have a rollback of the counter ...
We found a solution in order to get rid of thi sproblem : We don't read the angle position but the value of the counter, and then we manage the rollback and we calculate the angle position from the value of the counter. But as i said, for me the driver is bugged ... 

Try the meathod in the attached VI.
It looks at the error cluster and clears the timeout error if it's there. The output will be 0 when it sees this error. Make sure and specify a short timeout so your program will not hang waiting for the timeout.
Ed
Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Attachments:
Clear Counter Timeout.vi ‏35 KB

Similar Messages

  • What are the units of the DAQmx counter?

    Hello,
    I created this VI and several similar ones a few months ago, but, I have forgotten some of what I did back then.  I believe that this VI should measure period, using the counter on the DAQ chassis.  Can anyone tell me the units of the period measured?  I think it is seconds, but, I am trying to figure out how to figure that out!  The values of the period are generated by the DAQmx READ function in the WHILE loop.  What units is that function outputting to the array?  What are the units of the array elements, essentially?  See the attached VI.
    Also, how do you know?  I opened the DETAILED HELP for the DAQmx Read (Counter 1D DBL NSamp) shown in the VI but, I can't find anything on the units of the data coming out of the terminal labeled DATA with the orange wire, which is actually an array of periods, and we take the average of the most recent 15 or so period measurements.
    I had a suggestion months ago for an online NI manual containing a description of Buffered EdgeCounting measurements, but, when I went to find it, the link had been changed by NI, so, I can't find that manual, but, I think the answer is probably there, because I recall that manual being very useful when I did this before.
    Thanks for the guidance.
    Solved!
    Go to Solution.
    Attachments:
    continuously measure period buffered_singlechannel_forum Nov 13.vi ‏33 KB

    HI dav2010,
    When you create a Virtual Channel, you should specify the units the counter task will use.  There are several options which are listed in the help here:
    http://zone.ni.com/reference/en-XX/help/370469AA-0​1/lvdaqmx/mxcreatechannel/#DAQmxCreateChannel%28CI​...
    I am not on a computer with LabVIEW right now, but I believe the default should be ticks, which is the number of ticks of your device's timebase.  You can find that information in your hardware specifications.
    Regards,
    Chris E.
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • DAQmx counter okuma

    Merhaba,
    6218 DAQmx kartımla aynı anda 2 adet counter okumak istiyorum.
    1 adet DAQ Asistant oluşturoyorum. 2 adet Counter seçmek istiyorum ancak izin vermiyor. 2 adet DAQ Asistant oluşturup birinde counter 0 diğerinde counter 1 seçiyorum. Bu seferde programı başlattığımda "specified source is reserved" gibi bir uyarı veriyor.
    Low level VI lerle okutmaya çalıştım. Aynı anda 2 counter okuttum ancak onda da counter girişlerinden herhangi birine sinyal gelmediğinden program kitleniyor.
    Yardımlarınızı bekliyorum.

    Hey aero_b,
    I think you meant to post in the in the Türkçe forum: 
    http://forums.ni.com/t5/NI-Uuml-r-uuml-nleri-304-l​e-304/bd-p/3170
    This forum is our English language forum.
    Thank you,
    -KP
    Kurt P
    Automated Test Software R&D

  • 6024e DAQmx counter data

    hello,
    I try to use the NI DAQ taraditional example to control my DAQ6024E, but it doesn't come out any data. If I use DAQmx, I can get the data.
    Now, I have to use the 6024E counter to control the time event and record the analog data at the same time. I only know how to get the clock data by the traditional DAQ. Since it can't combine with DAQmx, could anyone please tell me how to get the clock data by DAQmx??
    thanks

    Hi Sai,
    When you say "get the clock data," what are you referring to? Can you tell me which example you used to get the clock data in traditional DAQ? Are you referring to the sample clock and number of samples written? Or something else?
    Thanks,
    Sal

  • NI-DAQmx Counter Frequency Measurement

    I need to measure the number of pulses obtained within a time period (3 secs).
    So if i use channel 0 to generate a gate pulse for channel 1 how can i do other other things while waiting for my 3 seconds to be up ?
    Has anyone got any VB6 code to do it. At the moment i have a task in Max to generate the pulse train with two leading edges every 3 secs.
    I use this output to gate the second counter channel. I then have a task created in VB to count edges. Then i would like
    DAQmxReadCounterU32 to NOT hold up execution while reading two samples.
    something like......
    while waiting for two samples
    loop

    Assuming you're doing buiffered event counting, you can monitor the status of the buffer without blocking by using the Read Properties.  I don't know the exact VB syntax, put the equivalent C funtion you need is:
    DAQmxGetReadAvailSampPerChan(TaskHandle taskHandle, uInt32 *data)
    You can use this function to poll within a loop and then call read only after a certain number of samples are available.  You can also continue to use the Read function but pass in a timeout of 0 or pass -1 for the number of samples to read.  Passing -1 will tell the driver to read all samples that are currently available and then return.  Depending on the method, you'll either have to handle timeout errors or check the actual number of samples read to see if you actually read anything, but neither method will block until samples become available.  You could also register a callback funtion for the Every N Samples Acquired Into Buffer Event and perform your read in that callback.  I hope this helps.

  • DAQmx Counter Input Measure a single pulse's pulse width

    Trying to measure a single pulse's pulse width. It appears that the DAQ only makes the measurement on the read command instead of after starting the task. I just get a timeout error. Is there any way to arm to counter for measurement or am I better off making a seperate thread to trigger my single pulse?
    double measured;
    int numSamp;
    TaskHandle taskHandle;
    DAQmxCreateTask("", &taskHandle);
    DAQmxCreateCIPulseWidthChan(taskHandle, "Dev1/ctr0", "", 0.025, 0.120, DAQmx_Val_Seconds, DAQmx_Val_Rising, "");
    DAQmxSetChanAttribute(taskHandle, "", DAQmx_CI_PulseWidth_Term, "/Dev1/PFI10");
    DAQmxStartTask(taskHandle);
    //Trigger the single pulse here
    DAQmxReadCounterF64(taskHandle, DAQmx_Val_Auto, 10.0, &measured, 1, &numSamp, NULL);
    Thanks,
    Dan

    Which device are you using?
    If you configure implicit timing (DAQmxCfgImplicitTiming) your measurements will be buffered and will begin when the task is started.  The minimum buffer size is usually (always?) 2 samples, but that doesn't mean you have to read two samples back.  
    Best Regards,
    John Passiak

  • How do I use daqmx to get encoder direction/count on M-series board?

    I have an incremental dual channel  encoder from Rotalink. I want to take angular postion and angular speed from this encoder. My NI DAQ card is PCI 6221 which belongs to M series. First, soft-timing was used to get anuglar postion and sampling rate is set at 1Hz. The vi program works well. However, it does not produce  good results when the sampling frequency is increased to 100Hz. So I turned to hardware-timing. The example, "Find example>> Hardware Input and Output>>DAQmx>>Counter Measurements>>Position>>Meas Angular Pos-buff ext Clk.vi" gets the readings. A function generator which can produce pulses at the frequency rang from 1Hz-1Mhz was wired to PFI9 in accordance with "
    You need to find your PFI pin numbers to know what to wire A,B and Z to on your m-series board, to do this go into max right click NI-DAQmx Tasks click Create New DAQmx Task >> Counter Input >>Position>>Linear, and setup the task for your measurement. It will tell you what the PFI lines are. You then need to look at the wiring diagram and connect it to the correct pins." as an external clock. The channel A and B were wired to PFI8 and PFI10 respectively. However, it still gives errors like 200284. Comments are grealy appreciated!

    Hi Zibin
    I have been trying to work out what is not working I need some more information
    What frequency is your function generator actually generating?
    What have you set your time out value to?
    What exact errors are you getting and when do you get the error?
    What would really be helpful is if you could send me your code because by the sound of it, it should just work the card is more then capable of doing what you want so chances are it is the code.
    Regards
    Tim M
    NI UK

  • How do I use daqmx to get encoder direction/count on E-series board?

    Hardware:
    PCI-6014
    Labview 7.1
    I have a linear actuator and wish to get distance/direction.  The
    motor has a quad encoder with phase A and B only.  I connected the
    lines according the the E-series, PFI-8 and PFI-6, and ground to
    digital ground. I then attempted to design a control with daqmx but
    failed.  I have tried the daqmx examples but none were attempting
    a reverse in direction.  Most examples given for direction change
    are for traditional daq control; i cant make a correlation on what to
    use to substite traditional daq with daqmx vi's. 
    2 questions:
    How do I use daqmx to get encoder direction/count on E-series board?
    Are there low pass filter vi's recommended for each phase connection to stabilize data?
    Thanks,
    Wayne Hilburn

    Hello Wayne,
    Take a look at the Count Digital Events.vi shipping example.  You can find this in LabVIEW by selecting Help >> Find Examples... then browsing to Hardware Input and Output >> DAQmx >> Counter Measurements >> Count Digital Events.
    If you set the "Count Direction" control to "Externally Controlled", you will be able to count up and down depending on which direction you rotate your encoder.  Make sure you wire Phase A to Ctr0 Source and Phase B to P0.6.  P0.6 is the up/down line for counter 0.
    I hope this helps.  Please let me know if you have any further questions.
    Regards,
    Sean C.

  • Up/down count edges: traditional daq vs daqmx

    Hello,
    I've inherited a program that uses an encoder to read the position of a torque-arm.  The program uses traditional daq.  The encoder position data is read using "Counter Read Buffer.vi".  Then, by simply casting the output of "Counter Read Buffer.vi" to an I32, the position data can be either positive or negative.
    1. Is this a valid method of using "Counter Read Buffer.vi"?  (I wonder because if I capture data as I move the torque arm back and forth, the data suggests that the encoder is not moving back to zero counts each time.  For example, the first time the arm is moved through its range, it might go from 0 counts to 100 counts; the second run may be from 10 counts to 110 counts, the third from 15 to 115 and so on).
    2. Is something this simple available in DAQmx too, or do I have to monitor each encoder point that I read to detect when the counter rolls over and handle it manually?
    Thanks in advance for any assistance!
    Chris

    Hello Chris,
    For the answer to your first question, this may be an issue with the DAQ device you are using. What exact device are you using?
    For the second part, the Measure Angular Position VI, found in the Example Finder under Hardware Input and Output»DAQmx»Counter Measurements»Position, is a good quadrature encoder VI for reading angular position.
    Try using this example and see if the behavior is different between the Traditional DAQ and NI-DAQmx code and let me know how it goes.
    Regards,
    Dan King

  • Buffered event counting, VB6, DAQmx

    I have an encoder that I would like to count the pulses per revolution on.
    I can do this in Traditional DAQ by setting the Counter Source and Gate.  Source being the encoder pulse train, and the Gate being the index on the encoder.
    How would I do this in DAQmx?  Every example I have seen is for event counting, but nothing to actually give you a PPR.
    Source is channel A of encoder.
    Gate is channel Z of encoder.
    Any source code tidbits will be very much appreciated.
    Thanks for your help.

    Big Guy,
    In DAQmx, the source and gate pins of each counter have default values.  You can find which pins you need to use by opening up Measurement & Automation Explorer (MAX) and then navigating to Devices and Interfaces>>NI-DAQmx Devices>>(Your Device) and then right-clicking and choosing Device Pinouts.  Unless there is an absolute need to use another pin, I'd recommend using the default pins shown below.
    Which DAQ card are you using?
    Default NI-DAQmx Counter Terminals
    Counter/Timer Signal
    Default Pin Number
    Signal Name
    CTR 0 SRC
    37
    PFI 8
    CTR 0 GATE
    3
    PFI 9
    CTR 0 AUX
    45
    PFI 10
    CTR 0 OUT
    2
    PFI 12
    CTR 0 A
    37
    PFI 8
    CTR 0 Z
    3
    PFI 9
    CTR 0 B
    45
    PFI 10
    CTR 1 SRC
    42
    PFI 3
    CTR 1 GATE
    41
    PFI 4
    CTR 1 AUX
    46
    PFI 11
    CTR 1 OUT
    40
    PFI 13
    CTR 1 A
    42
    PFI 3
    CTR 1 Z
    41
    PFI 4
    CTR 1 B
    46
    PFI 11
    Josh W.
    Certified TestStand Architect
    Formerly blue

  • I'm trying to use DAQmx for simple event counting using PFI8

    Hi,
    I am presently using Traditional DAQ (Legacy) drivers in my software, however I'm in the process of switching over to DAQmx drivers.  Our systems use an E Series DAQ card: PCI-MIO-16XE-10.
    I use PFI8 along with Counter 0 to do simple event counting.  The signal is connected to PFI8 and as it changes, my counter output either increase or decreases in value.  The attached vi shows how I've done it in the past using the Legacy drivers (top portion of the vi) and how I'm attempting to do it using the DAQmx drivers.  I've combined both versions on the single vi just for illustration purposes - when I do my testing they are on separate vi's.
    I'd appreciate it if anyone could help me to figure out why my DAQmx version isn't working properly.  Thank you very much!
    Steve
    Attachments:
    PFI8_DAQ_Comparison.vi ‏36 KB

    Hey Steve,
    The DAQmx driver installs several examples into LabVIEW that
    demonstrate how to implement various event counting applications.  I
    recommend you look over these and see if any of them accomplish what
    you're trying to do.  They're usually very simple to understand and
    well documented, but I'd be happy to help you out with any of them if
    you had a particular question. 
    You can find them in the Example Finder (Help >> Find Examples)
    in LabVIEW.  Drill down to the following location in the directories:
    Hardware Input and Output >> DAQmx >> Counter Measurements >> Count Digital Events
    You'll see a number of examples, but I recommend starting with 'Count Digital Events.vi'
    Since PFI8 corresponds to CTR0 SRC, make sure you set it to use counter 0.  This should work correctly.
    Elijah Kerry
    Senior Product Manager, LabVIEW
    Follow my Software Engineering for LabVIEW Blog

  • How to count number of edges using PXIe-6363 Counters

    Hello,
    I am trying to count number of edges in a test signal in a 50 ms duration. I am using PXIe-6363 card and connecting the test signal to CTR 0 SRC (PFI 8). Is it a correct connection? What else do I need hardware-wise to make a correct set up for this application?
    Thanks
    Jeet
    Solved!
    Go to Solution.

    Hi Jeet,
    When you say interrupt signal, do you mean a pulse that will pause your counter task? If that is the case, and you want to pause your task with a digital pulse, you need to use the DAQmx Trigger Property Node and set that to Pause, Trigger Type. As you said, you can connect that signal coming from the chip to any PFI line and then set that line as the source of the property node.
    There is an example that you can use that does exactly what I just described. This example is called Count Digital Events-Pause Trig.vi, and you can find it by going to Help>Find Examples..., then on the NI Example Finder window go to the Browse tab and navigate in the folders to Hardware Input and Outpout\DAQmx\Counter Measurements\Count Digital Events.
    Regards.
    Jorge
    Applications Engineer
    National Instruments
    Certified LabVIEW Associate Developer (CLAD)

  • NI-DAQmx DAQmxReadCounterF64 function

    Here is VB6 code to use Ctr0 on PXI-6254 (in slot 2) to do 'PULSE WIDTH' measurement:
    Dim taskHandle As Long
    Dim ctrData As Double
    Dim sampsPerChanRead As Long
    Dim MinVal As Double
    Dim MaxVal As Double
    MinVal = 0.001
    MaxVal = 1.0
    Line 1: DAQmxErrChk DAQmxCreateTask("", taskHandle) 'Create Task
    Line 2: DAQmxErrChk DAQmxCreateCIPulseWidthChan(taskHandle, "PXI1Slot2/Ctr0", "", MinVal, MaxVal, DAQmx_Val_TimeUnits3_Seconds, edge, "") 'Add Ctr channel to the task
    Line 3: DAQmxErrChk DAQmxStartTask(taskHandle(taskNo%)) 'Arm counter and start measuring 'Arm and start measurement
    'some time later following call is made
    Line 4: DAQmxErrChk DAQmxReadCounterF64(taskHandle, 1, 10#, ctrData, 1, sampsPerChanRead, ByVal 0&) 'Read the pulse width
    Observation:
    1. It seems that if there is nothing connected to the Ctr0 input pin or there is no pulse at the input pin then Line4 above times out after 10 seconds, i.e., VB6 program feezes up for 10 seconds.
    2. It was also observed that if I use 'Simulated NI-DAQmx Device' for PXI-6242's Ctr0 (set up in MAX) then Line 4 returns right away.
    Questions:
    1. Is there any way to make Line 4 'asynchronous' and exit and return pulse width value measured 'so far'? For example, if actual pulse widht is , say, 83 ms, and when Line 4 is executed only 40 ms pulse is done then I would like to see DAQmxReadCounterF64 return 0.040 s. When I get two consecutive readings same, I will know Pulse is done. This way, my 'Pulse Width' value display on the screen counts up starting from zero and stops when pulse is over. NOTE: I do not like to use NI-DAQmx CALLBACKs in VB6 because I think they are not reliable.
    2. If I use DAQmxIsTaskDone function, will it tell me when pulse width measurement is over?
    3. If answer to Q2 is 'yes' then what happens if second pulse starts before I get a chance to read the first pulse width value?
    4. Why does 'Simulated NI-DAQmx Device' behave differently for Line 4?
    Thank you.

    Hello,
    The functionality you are requesting for may not be plausible since counter tasks return values at rising/falling edges (see the link 1 below, section on Counters, Chapter 7 of the M-Series User Manual). A recommended approach would be to use a Digital Input Task; this would require VB6 code manipulation on your end, to read a set number of samples periodically (also, a change in your signal from low/high or vice versa would need to be taken into account). DAQmx Is Task Done function checks if the measurement or generation is finite and the task is done when you acquire/generate the final sample or when you call the Stop Task function/VI. If the measurement/generation is continuous (including on-demand timing), the task is not done until you call the Stop Task function/VI. In addition, the task is done if a fatal error is generated while performing the measurement or generation, or you abort the measurement or generation. NI-DAQmx tasks for simulated devices are verified just as they are on real devices, hence all resources necessary for counters, and so on, are counted and reserved for NI-DAQmx simulated devices just as they are on real devices. However, an important thing to note about simulated DAQmx Counter data is that its always returned as 0 (see link 2 below).
    1. M-Series User Manual (Chapter 7: Counters): http://digital.ni.com/manuals.nsf/websearch/2025C99AB0614F9E8625748000577B9A
    2. NI DAQmx Simulated Devices: http://zone.ni.com/devzone/cda/tut/p/id/3698
    Regards,
    Ali M
    Applications Engineer
    National Instruments
    Message Edited by Ali M on 04-05-2010 05:47 PM

  • Incremental encoder: reset counter on pci 6014?

    I want to connect an incremental encoder with A, B and Z to a PCI 6014 card. I found some VI's for counting A and B (DAQmx->Counter->Count Digital Events; DAQmx->Counter->Measure Posititon) . However I can't figure out what to do with the Z. Is there a way to reset the counters by Z? (I am using labview 2009)
    Thank you very much!

    Sorry, my fault. I didn't see you have an E-Series device.
    Resetting your counter with a digital trigger is possible for Counter/Timer devices but not for your PCI 6014.
    You can reset the counter with DAQmx by stopping and starting the task again. You could read your Z index on a digital input, if the input goes high (or low) you could reset the counter.
    DAQmx: Count Digital Events with Option to Reset Counter
    http://decibel.ni.com/content/docs/DOC-6576 
    I think this is the only way for the PCI 6014. Since you have to go through several software layers, the performance goes down a bit. If it is possible, i would recommend to change to a M-Series device...
    Cheggers
    Sascha E.
    Group Leader Applications Engineering
    National Instruments Switzerland

  • How do I associate a clock (source) with a (or multiple) counter channels

    We are newbies using a 6602 with the SCB-68 interface.
    We are reading 8 different TTL pulse trains. We've determined that we need buffered periodic event counting (BPEC) and that we need a common clock (source).
    We've used the measurement and automation software to confirm that we can see our signal coming into the card. However, we cannot seem to perform functions requiring a clock (e.g. BPEC).
    Question: How do we associate an 80 MHz clock to the source for our counter channels? The the card has clocks, yet our error messages indicate that an external clock had to be used for our task. We may be stuck in the meaning of "external".  Though a clock is in the card, is it considered external to my counter channel? Do I connect it via jumpers in the SCB-68 or are there ways to associate it via commands?

    Hi NHJared,
    There a few examples in the LabVIEW Example finder that will
    help you make these measurements.  (Help
    >> Find Examples >> Hardware Input and Output >> DAQmx
    >> Counter Measurements >> Period or Pulse Width)
    The DAQmx Timing VI should be set to implicit.  This setting will automatically route the appropriate
    clock necessary for your measurements. 
    An external clock is a signal that is created by another device other
    than the PCI-6602 and connected through an external pin on the PCI-6602 (e.g. PFI
    pin) 
    Respectfully,
    Rob F
    Test Engineer
    Condition Measurements
    National Instruments

Maybe you are looking for

  • How to safely remove all backups from Time Machine/Time Capsule?

    I plan to 'clean up' my Time Machine/Time capsule completely, whereby I want to make it impossible for third parties to recover all or part of these old backups. After I have accompished this I want to start from scratch backing up my Mac. Can you pl

  • How to print links in a PDF

    I have created multiple blue coloured link boxes in a pdf file which will open a pdf image. The linked boxes can be seen/viewed in the pdf but do not show in the printed copy of the pdf. Can anyone please advise how to include printing the links with

  • Can anyone give me Interview question on forms6i and reports 6i(its urgent)

    plz give me Interview question on forms6i and reports 6i its urgent .plz mail it to me on paritosh [email protected]

  • Capacity load as real routing works

    Hi:    I have anther question about SFC capacity leveling..why capacity load is not the same as production scheduling? for example:PO require 52 hours for producing 100kg finish material and it automatically schedule the start date based on the finis

  • Simulation of solar systems

     i want to design a microgrid in terraced houses using the solar panels as a source of energy and feeding this energy to the loads in the houses .i am actually wondering if the labview was provided with a built in blocks for solar panels ,inverters ,