Multi counter PCI 6602 daqmx semi period measuremen​t

Hi All, Currently I am working on 20 PWM input channels. I have some problem on my labview code. Would some one give some advice on my vi? I crated labview code for 2 channels for now. I am doing semi period measurement. I want to measure the frequency and duty cycle of the PWM signals. But when I run it, it has error. Please give some advice where I did wrong on my vi. thanks Johnny
Solved!
Go to Solution.
Attachments:
Multi PWM Reading.vi ‏118 KB
erorr message.doc ‏91 KB

Hi marconi,
This error that you are getting is a buffer overflow error and is likely due to the value that you used as an input to "number of samples" on the DAQmx Read VI. You had it set to 4 but depending on how fast the PWM that you are reading is, you may be acquiring values to the onboard buffer much faster than you are retrieving them with the DAQmx Read VI. Then when you call the DAQmx Read VI, which reads relative to a read pointer the data that you are expecting to read from the buffer has already been overwritten. One way to get around this is to increase the number of samples to read each time you call the DAQmx Read VI. I tried out your VI and got it to work with a slight modification to the start trigger (using PFI0 instead of the 20MHz timebase) and added a loop condition to stop from getting a buffer underflow error as well. Take a look and see if this helps out. Also, why are you triggering off the 20MHz timebase? is there a particular reason? This is essentially like using no start trigger since you should get the first rising edge of that almost immediately after the DAQmx Start VI is called. I am just curious, since using this start trigger did not actually work for me (though I didn't look into why). 
Chris W
Attachments:
Multi PWM Reading.vi ‏51 KB

Similar Messages

  • PCI 6602 signal no periodic

    bonjour,
    je voudrais simuler un signal non périodique et synchrone sur une seul des sorties de compteur de la PCI-6602.
    Cependant j arrive a simuler mon signal mais j utilise deux compteurs :
    pour cela j ai utilisé un des sous VI de multiple pulse train c est a dire "configure and arm counters phase(NI-TIO)(with phase delayed)"
    mais j ai enlevé le sous vi "counters start triggers "
    j'ai voulu synchronisé mon signal via un generateur externe dont j ai definie les parametres dans le diagramme de mon vi (numero de PFI).Puis j'ai décomposer mon signal en 2(voir attached files).Une fois que je suis arrivé a visionné mes signaux sur l'oscilloscope,
    j ai relier mes 2 signaux a une "porte ou" à 2 entrées.
    soit S la sortie de la porte l
    ogique on obtient donc:
    S = compteurs 0 ou compteur 1
    merci""
    Attachments:
    chronogramme_des_signaux.doc ‏22 KB

    With this setting, the edges of the internal 20MHz timebase of the PCI-6602 are counted !
    Change Edge Source to /Dev1/PFI39 (--> CTR 0 source --> signal A of the encoder with your wiring) and try again.
    See page 3-7 of the user manual for the PFI numbers.
    Some examples ship with LabVIEW.
    Message Edité par JB le 03-13-2008 08:44 AM

  • PCI-6602 Triggered event counting DAQmx

    Hi
    I'd like to use simple event counting using PCI-6602 (DAQmx) with an internally generated trigger pulse.
    But I don't know how to figure out the error message when I use DAQmx Start Trigger.vi
    Thanks
    Kyu Young
    Attachments:
    EventCountingTrig.vi ‏21 KB

    I'm sorry. I've solved it.

  • How to synchronize two PCI-6602 via RTSI for semi-period counting of four signals?

    Hello,
    I try to measure 4 PWM signals. For that, I created 4 tasks (newest DAQmx), each with semi-period measuring one signal.
    I want to use DMA so I have two 6602 for each two signals.
    The task aquire a finite number of samples.
    This works fine when starting the tasks subsequently.
    Now I want to start the tasks via a trigger on the RTSI bus.
    But I have no idea how to get this done.
    I use the MX drivers for the first time an find it very difficult to get through the help files.
    I looked at many examples but did not find a solution.
    Most of the time my experiments end with an error message saying that the property is not applicable to this task, or s.th.similar.
    Ans sometimes, when there seems to be a trigger defined, the task will not wait for the trigger and time out.
    Is the anybody who can help me out of this?
    Maybe a little sample program?
    I program in CVI.
    Many Thanks
    Michael.

    This topic is discussed here:
    http://forums.ni.com/ni/board/message?board.id=250&message.id=13383&requireLogin=False
    Hope this helps!

  • NI PCI-6602: semi-period measurement stops unexpectedly or returns wrong values

    Hi,
    Using an NI PCI-6602 card we try to measure the semi-periods of a digital signal.
    In "continuous sampling mode", 10 samples are collected in the buffer and then are read
    out.
    Up to 6 counters on this card are sampling the same signal in our testing configuration.
    Here we found these issues:
    1. Failure
    In principle, the measurement runs correctly, but one or more counters sporadically may
    suffer a complete failure. I.e. these counters don't provide samples anymore.
    Only after stopping and restarting the assigned task, a failed counter works again.
    Apparently, a counter failure is most likely to happen when
        - the sampled signal "changes", i.e. when the pulse width of the signal changes,
        - or when the computer load is high, e.g. when opening a window of another application.
    Every counter occasionally failed, but the issue was found very often at counter 1 of
    the PCI-6602 card, if we used counters 0 through 5 in parallel.
    Using another PCI-6602 card, the failures happened preferably on counters labeled "near"
    number 5.
    2. Wrong values
    Occasionally the "interpretation" of the sampled values changes, i.e. the length of the
    "high level" period is returned, where the "low level" period length should be given, and
    vice versa.
    This is our task configuration:
    Configuration done with MAX:
    Signal input range:    2 usec - 2 sec
    Custom Scaling:        None
    Sample mode:        continuous
    Buffer size:        10 Samples
    In addition these calls are made:
    ret = DAQmxSetDigEdgeArmStartTrigSrc( task->mHandle, <use the same terminal as is used for
    the signal to be measured>);
    ret = DAQmxSetArmStartTrigType( task->mHandle, DAQmx_Val_DigEdge);
    ret = DAQmxSetDigEdgeArmStartTrigEdge( task->mHandle, DAQmx_Val_Rising);
    ret = DAQmxSetCISemiPeriodStartingEdge( task->mHandle, <the channel>, DAQmx_Val_Falling);
    Best regards
    Manfred

    Hi Manfred7,
    did you already test this behaviour with a simple example from us?
    Just go through the example database and try the examples there.
    These examples should work. 
    If it works, there is a problem with your programm.
    If it won't work, please tell me more about your software:
    - Version
    - DAQmx Version ,...
    best regards
    Dippi 

  • Counter using PCI-6602 for multi output

    Hi guys,
    currently I tried to control a linearmotor using PCI-6052E and PCI-6602.
    The questions is, how to use PCI-6602 to be a counter which will be converted to several output (multioutput):
    (1) converted to position >> 1count = ...[mm] --> position measurement
    (2) converted to voltage >> 1count = ...[mV] or [V] --> voltage measurement
    (3) converted to current >> 1count = ...[mA] or [A] --> current measurement
    (4) converted to velocity >> 1count = ...[mm/s] --> velocity measurement
    (5) converted to acceleration >> 1count = ...[mm/s^2] --> acceleration measurement
    (6) converted to force >> 1count = ...[N] or [kg.mm/s^2] --> force/load measurement
    (7) converted to frequency >> 1count=...[Hz] --> frequency measurement
    (i) Please assist me how to connect the driver's encoder (Ch. A A/ B B/ Z Z/) with PCI-6602, so I can get all informations above (7 measurements). What/which port of PCI-6602 connect to where from the driver.
    (ii) Please assist me how to connect the feedback signal to the PC. What/which port of PCI-6602 connect to PC.
    (iii) How to test those 7 measurements above using Measuremant and Automation Explorer (MAX) ver.4.4.1?
    Thank you for your kindly help and assistance.
    Best wishes,
    hendro

    Dear Jochen,
    (1) Principally, I'd like to use PCI-6602 to be a motion encoder also be a counter (Is it possible? Due to the manual, it is possible). I expect to have all information, such as position, time, velocity, etc. from that motion encoder (or at least the position and time). It is also expected of using PCI-6602 to do all measurements that I mentioned before . My meaning is, after having a signal from the counter, that 'count' will be converted to desire units under other programs. So, in this case, PCI-6602 is only used to get the 'count'.
    Simplified, the voltage command will send to the system (linear motor) through PCI-6052E (-10V to 10V). The actual position or other actual information will be catched (read) by using PCI-6602 (as a motion encoder, also as a counter). Then, this actual position will be used as a feedback, that will be compared to desired position.
    Is that also possible to use PCI-6602 be a motion controller + a counter + a frequency measurement in a same time parallely?
    I don't decide yet (I don't know) which acquisition rate will be needed/required, higher is better.
    (2) I'd like to apply an adaptive robust controller (yes, it is a closed loop system) under matlab with their feature called Real-Time-Workshop instead of using LV.
    (3) Power drive for the linear system will be driven by AC servo drive.
    Thanks for your help before,
    Warmly regards,
    hendro

  • Error -200141 when doing buffered events with DAQmx and PCI-6602

    When doing buffered events with DAQmx and PCI-6602 I get error 200141 - Data was overwritten before it could be read by the system.
    This error is generated ONLY with random inputs >200/sec.
    My setup is :
    DAQmxCreateCIVCountEdges(taskhandle,"Dev1/ctr3"....
    DAQmxCG+FGSampClkTiming(taskhandle,"/Dev1/FPI35",...
    DAQmxSetCICountEgdesChan(taskhandlem,"", "/Dev1/80MHZTimeBase")
    DAQmxSetChanAttribute(taskhandlw,",",DAQmx_CI_DataXferMech,DAQmx_Val_DMA,0);
    Can somebody help ?

    i'm getting the same Error-200141, while reading semiperiods. (Meas_Buffered semiperiod continous)
    while loop ex.rate seems to be pulsewidth*no.Samples to read. in my case PW=60ms
    Input buffer size measured with Property node= 10000
    why this error happens?? i cant use any mode other than implicit timing for semi-period measurement right??
    more info: all the ai channels are used ~ 16 differencial.
    i found one solution which is _ reinitializing the whole task if an error occur. is this the right way??
    Kudos always welcome for helpful posts
    Attachments:
    Counter_1_Meas Buffered Semi-Period-Continuous_main_lv09.vi ‏34 KB
    SemiPeriod_Reconnect Counter on Error.vi ‏35 KB

  • Frequency divide by N doesn't work on Counter-Ti​mer PCI-6602

    Hello everybody,
    I tried to do something basic ( ?) with this Counter-Timer 6602 Board, and it doesn’t work.
    So I hope some people with more experience than me could understand what happens here.
    1) What I need:
    I need to generate 4 synchonised clocks, whose periods will be multiple of 1 ms.
    2) What I have:
    LabVIEW 7.0 and a PCI-6602 Counter-Timer Board in a DELL PC running under XP pro.
    The PCI-6602 Counter-Timer Board has 8 counter timers named CTR 0, CTR 1, ... CTR7.
    3) What I have already done, and that worked:
    - Generate a 1 kHz “Master Clock” signal from CTR 4, configured by “Continuous Pulse Generator Config.vi” (found in “Data Acquisition, Counters...).
    - configure CTR 0 and CTR 1 to work as frequency dividers, by use of “Down Counter or Divider Config.vi”.
    - Apply the output signal of CTR 4 (OUT ) to the SOURCE inputs of CTR 0 and CTR 1 by means of physical wiring in the SCB-68 connection box.
    When I do this, I get two nice secondary clock signals on my oscilloscope screen, ( with periods = 3 ms, or 5 ms or whatever multiples of 1 ms I choose) from CTR 0 and CTR 1 outputs , very clean and perfectly in phase with the 1 kHz Master Clock.
    So far, so good...
    But I still need 2 more secondary clocks...
    One would say: “No problem, do the same trick with two other counters...” Well, not so simple, it seems...
    4) What I tried to do, and that didn’t work:
    When I try to do the same frequency division with any of the remaining counters, (CTR2 to CTR7), the program stops and I get an error “ –10020 : Time base not valid “.
    I can’t figure out what happens here: I thought any counter could be configured to work as a frequency divider, but it seems not to be so, and I am stuck here.
    Has anyone an idea about how to fix this type of problem?
    Attached file: hor_div02New.vi
    Attachments:
    hor_div02New.vi ‏123 KB

    karolik,
    I'm just adding a followup in English. As Marc L. mentioned, the particular vi named "Down Counter or Divider Config" isn't compatible with the 6602. While the 6602 does have the ability to generate 4 synchronized clocks, a different syntax is needed. Here's how I'd do it:
    Traditional NI-DAQ
    1. Configure a continuous pulsetrain on CTR 4. Route its output to, say, RTSI 4. Don't start it yet.
    2. Configure CTR 0,1,2,3 for continuous pulsetrains using RTSI 4 as their "timebase source." Start them.
    3. Start the CTR 4 pulsetrain.
    4. Now CTR's 0-3 should generate separate clocks with synchronized phasing.
    DAQmx
    1. Configure a continuous pulsetrain on CTR 4. Don't start it yet.
    2. Configure CTR 0,1,2,3 for continuous pulsetrains using "Ticks" for units. Use a DAQmx property node (probably Channel property node, but am not 100% sure and don't have a LV PC handy to check) to specify that the "ctr4 internal output" should be used as the timebase. Start them.
    3. Start the CTR 4 pulsetrain.
    4. Now CTR's 0-3 should generate separate clocks with synchronized phasing.
    -Kevin P.

  • PCI 6602:How can I use the digital lines of the board and in the same time to generate pulse train using a counter?

    Hello!
    My problem appeared when I tried to update my code from Traditional NI-DAQ Legacy to DAQmx.
    I am using 2 counters (counter 5 and counter 7)  from PCI-6602, to generate pulse train, and also the Digital I/O lines of the port 0 (the lines form 0 to 7). What I do in my application is that I am starting to generate the pulse train on the output of the 2 counters, and after that I am playing with the state of the digital lines.
    In traditional there was no problem using the counters and the digital lines in the same time, everything was going perfectly, but in DAQmx this is not possible.
    What happens: I start to generate pulse train on the output of the counters,  no errors encountered, but when I try to modify the state of one line of the digital port the generation of the pulse train is stopped. This is happening when I start the task associated to the digital port.
    My question is: it is possible to create a channel on the digital lines without altered the channels created for the counters?
    Another thing what I manage to see using the  "Measurement & Automation Explorer" and Test panels for PCI-6602, basically is the same thing, I generate pulse train on the output of the counter 7 and try to start a task on the digital line, but I get one error :
    "Error -200022 occurred at Test Panel
    Possible Reason(s):
    Measurements: Resource requested by this task has already been reserved by a different task.
    Device: Dev4
    Terminal: PFI8"
    Instead if I use the counter 0 or counter 1 to generate pulse train I don't encounter the same problem.
    Which resources are used by the counters 2 to 7 from the PCI-6602 board and the counters 0 and 1 do not use?
    Thank in advance for any replies!
    Ciprian
    Solved!
    Go to Solution.

    Hello Jordan, thank you for your reply.
    I am sorry but I can not see or run your example, I don't use LabView, I use Visual C++ for developing.
    Here is the code for generating the pulse train:
    GeneratePulseTrain(unsigned long ulCount1, unsigned long ulCount2)
        short nStatus = 0;
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        nStatus = DAQmxCreateCOPulseChanTicks (m_taskHandle, "Dev4/count5", "", NULL, DAQmx_Val_Low, 0.0, ulCount1,ulCount2);
        if( bTriggerMode == true) // if hardware trigger is enabled
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_ArmStartTrig_Type, DAQmx_Val_DigEdge);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Edge, DAQmx_Val_Rising);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Src,"Dev4/PFI17" );
        //set the internal timebase
        nStatus = DAQmxSetCOCtrTimebaseSrc(m_taskHandle,"Dev4/count5","20MHzTimeBase" );
        nStatus = DAQmxStartTask(m_taskHandle);
        return nStatus;
    And the code where I try to set the digital line:
    SetChannelState(short nState)
        short nStatus = 0;
        uInt8 wrtBuf0[1]={0};
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        // Configure line as output 
        nStatus = DAQmxCreateDOChan (m_taskHandle, "Dev4/port0/line0", "", DAQmx_Val_ChanPerLine);
        nStatus = DAQmxStartTask(m_taskHandle);
        wrtBuf0[0] = nState;
        nStatus =DAQmxWriteDigitalLines (m_taskHandle, 1, 0, 0, DAQmx_Val_GroupByScanNumber , wrtBuf0, NULL, NULL);
        nStatus = DAQmxWaitUntilTaskDone(m_taskHandle,10);
        nStatus = DAQmxStopTask(m_taskHandle);
        nStatus = DAQmxClearTask(m_taskHandle);
        m_taskHandle = 0;
        return nStatus;      

  • Count digital events on a Counter with pci-6602 with callback on CVI

    Hi,
    I'm using a PCI-6602 card with CVI 8.5 and I need to trig on event.
    On every pulse I received, I need to do some actions like increasing a counter, send a message on Rs232 etc.. I don't want to do any loop checking that the counter value has changed. I would like to use a callback to execute this code only on the edge or counter value event.
    My problem is that I don't know which function can do this. Is there any way to get an event on a pci-6602? 
     Thanks 
    James 
    Solved!
    Go to Solution.

    Hello.
    It's completely possible to create a callback that will allow you to do what you want when a edge will occur on an external signal you define.
    To do this, you can for exemple create a counting edges task that will use one of the 6602 counters,and the set your external signal to be the source of your sample clock.You'll then be able to register a callback with the function DAQmxRegisterSignalEvent, and your callback will be called each time an edge will occur on your specified sample clock source.
    Here's 2 links that explain the events in DAQmx and how to handle them in CVI. The example ReadDigChan-ChangeDetectionEvent.pr that ships with DAQmx examples (Hardware Input and Output<<DAQmx<<Digital measurements) can be very useful to understand how to do. This example creates a signal event callback to detect change detection for digital inputs.
    Regards.

  • How to generate an Interupt for DMA transfer from Counter on NI-PCI-6602

    dear guys:
          how to generate an Interupt for DMA transfer from Counter on NI-PCI-6602,and I have set the DMA and DMA_INT, and also the global interrupt register.
    but there is no Interupt generated in the Interupt callback function.And when I have set the DMA_INT and global interrupt register ,and then read the relevant register,the relevant bit is also 0.
         I suspect there is an Interupt register contral, like the MITE, you must write the value to 0xc4 for opening .
         there is some codes In my enclosure .What can I do?
    Attachments:
    TEST.C ‏21 KB

    dear Steven_T:
            the registers are In my enclosure ,if you have some ideas,please reply me  first time.thank you !
    Attachments:
    PCI6602.pdf ‏818 KB

  • DMA transfer rate for PCI-6602 counter/timer

    I'm strongly interested in raising the DMA transfer rate between the PCI-6602 counter and computer. At the moment, I've got a Pen-4 2.4GHz operating under Win98. I have to move an 80 Megaword array at an ~5 MHz speed. So far, I've been able to reach just 2 MHz. Would it be possible? What is the battleneck here - the soft- or hardware?

    Hello,
    I think the bottleneck you are seeing here is a limitation of the dma transfer capabilities that is dependant on the bus of your PC and not your 6602 card. Here is a link of a knowledgebase that you could try to use to see if that would improve your transfer rates. I still doubt you will be able to achieve approximately 5MHz.
    http://ae.natinst.com/operations/ae/public.nsf/fca7838c4500dc10862567a100753500/1b64310fae9007c086256a1d006d9bbf?OpenDocument
    Regards,
    Steven B.

  • PCI-6602: Stop counting after roll over

    Hi,
    I'm programming a PCI 6602 Board and want to stop a counter after
    it had a roll over. This option isn't available in the NIDAQ 6.7 I think!
    If you know, how I could manage it, please reply.
    thank you
    Steve Dreger

    Error -10920 is normally caused by speed limitations of your computer. Normally changing from debug to release mode will help fix this. Here are several other KBs that explain this error and how to fix it.
    http://digital.ni.com/public.nsf/websearch/8FB9091CB9BB452B8525642000554799?OpenDocument
    http://digital.ni.com/public.nsf/websearch/5D7774A864C1EE1786256713005D848D?OpenDocument
    http://digital.ni.com/public.nsf/websearch/5d7774a864c1ee1786256713005d848d?OpenDocument
    http://digital.ni.com/public.nsf/websearch/5d7774a864c1ee1786256713005d848d?OpenDocument
    http://digital.ni.com/public.nsf/websearch/1B64310FAE9007C086256A1D006D9BBF?OpenDocument
    If running the ResetDevice command does not work. I suggest opening MAX up and right click on Tradio
    nal NI-DAQ Devices, and then click on Reset driver.
    I hope this helps out.
    Joshua

  • Triggering the reading of counter totals (PCI 6602)

    Hi,
    thanks for reading these lines,
    for a special application I need to read the totals of multiple counters
    simoltanouesly. The inputs of the counters are connected to quadrature encoders.
    Is there a way to reroute the gate to another input pin?
    Thanks for taking the time to support me.
    live long and prosper
    Michael

    Dear Jochen,
    (1) Principally, I'd like to use PCI-6602 to be a motion encoder also be a counter (Is it possible? Due to the manual, it is possible). I expect to have all information, such as position, time, velocity, etc. from that motion encoder (or at least the position and time). It is also expected of using PCI-6602 to do all measurements that I mentioned before . My meaning is, after having a signal from the counter, that 'count' will be converted to desire units under other programs. So, in this case, PCI-6602 is only used to get the 'count'.
    Simplified, the voltage command will send to the system (linear motor) through PCI-6052E (-10V to 10V). The actual position or other actual information will be catched (read) by using PCI-6602 (as a motion encoder, also as a counter). Then, this actual position will be used as a feedback, that will be compared to desired position.
    Is that also possible to use PCI-6602 be a motion controller + a counter + a frequency measurement in a same time parallely?
    I don't decide yet (I don't know) which acquisition rate will be needed/required, higher is better.
    (2) I'd like to apply an adaptive robust controller (yes, it is a closed loop system) under matlab with their feature called Real-Time-Workshop instead of using LV.
    (3) Power drive for the linear system will be driven by AC servo drive.
    Thanks for your help before,
    Warmly regards,
    hendro

  • Samples Not Acquired on NI 660x or NI 6624 Devices When using pulse width, semi-period or two-edge separation buffered measurements with the NI 660x and NI 6624 on counters 0 and 1, some samples may not be acquired under certain circumstances.

    In the DAQmx 9.4 Readme the following is stated:
    Samples Not Acquired on NI 660x or NI 6624 Devices When using pulse width, semi-period or two-edge separation buffered measurements with the NI 660x and NI 6624 on counters 0 and 1, some samples may not be acquired under certain circumstances.
    Could anyone elaborate on this? I am particularly interested in knowing under what circumstances this problem arises for the 6602 PCI devices.
    How should I understand 'NI 660x and NI 6624 on counters 0 and 1'. Is it only a problem on counter 0 and 1 for the 660x or does this only apply for the 6624 devices.
    /mola 

    Are there any NI Product Support Engineers out there who has an answer to this question and who are willing to share it with me?

Maybe you are looking for

  • My iTunes Plus songs are no longer Plus in iTunes

    I upgraded my iTunes songs to Plus a year or so ago. I created an MP3 from one just to make sure the DRM was gone and it was. I paid my money and all is good. Today I want to make some more MP3 files to play in my car. Low and behold all my previousl

  • Arabic numerals not displaying in Swing text components

    On a test system setup with Windows NT Arabic version, we had problems entering Arabic numerics into Swing text components. Other Arabic characters were displayed correctly, but numerals were all represented by Western characters ('0 to 9'). Even whe

  • Integrate Word Templates in CRM5.0 Webclient

    Hello, i want to integrate Word-Template handling in the IC-Webclient. Which steps have to be done to make this work? I allready read the FAQ about the "Fax and Letter Processing in ICWeb". But there's nothing mentioned about the configuration to do

  • My new RAM doesn't work with my iMac.

    Hello, I bought new RAM 4GB PC10600 DDR3 1333MHz SO-DIMM to installed in my iMac 3.4 GHz intel core i7, osx lion. I try to installed it alone without original RAM (2GB * 2 pcs) installed to check how it works. After press start button, there are 3 be

  • How do I take still Photos from Videos on iphoto11

    How do I take still Photos from Videos on iphoto 11