Synchroniz​ing counter and analog tasks

Hi,
I would like to synchronize an analog task and a counter task. I want to share the AI sample clock for the analog task and the counter task. I found an example on NI website that seem be be suitable:
http://digital.ni.com/public.nsf/allkb/BB7AE2D12BB​04CBE862574FA005D3826
I'm trying to use the first example given in the KB: CounterSynch-Analogtask.vi. I'm using a PCI 6621 with LV 8.6 and DAQmx 8.7.2.
I'm getting an error when running this example (see attachment).
I also tried to insert a DAQmx read property node(available samples per channel) inside the while loop reading the data and connect to one of the counter task This one always displays a 0 value. If I simulate the 6621, the property node value is increasing at the beginning and then decreases to reach 0 and I finally get the same error that I got with the card.
If you have an idea on what could be the root of problem.
Thanks in advance.
Best regards.
Clément GIROD
DAM
Solved!
Go to Solution.
Attachments:
DAQmx error.JPG ‏83 KB

Hi Clemente,
The reason you were getting this error is because the counter task was set to finite while it is continuously reading in the while loop.
The VIs on the same link have been editted so that they will work. Please chech them out and see if they work.
 Please let me know if you have any further questions.
Best Regards,
Faris A
Bueller

Similar Messages

  • Synchronize a counter and Analog Output

    Hello all,
    I want my Analog Output generation and my Counter0 operations to start at the same time. Any ideas how to accomplish it.
    I have tried to feed the output of another counter1 to the gate of counter0 as well as to the clock source of Analog Output (GPCTR1).
    This however doesnt seem the solution.
    Will appreciate any suggestions.
    Thanks

    Mili,
    I think you'll have to experiment, but it might be possible to do both operations with the equipment you have. This would be relatively easy with an NI 660x counter/timer board.
    You can use the Route Signal VI to send your counter output to a RTSI line and then select the RTSI line as your counter 1 gate. (this is the generic solution for any number of counters)
    For getting an external update clock, check out the continuous external clock example programs that are included with LabVIEW or NI-DAQ.
    You can easily start your output with a digital trigger, but the STC counters do not allow for digital triggering of counter operations. You may be able to come up with some programming scheme that gets counter 1 started, but gated low so t
    hat it is not counting until the start trigger comes in for the acquisition (such as a start trigger that is forced low until the start trigger for the analog input comes in). This would be a design you would have to work out or see if anyone else has found a way to do it.
    You can also search for many example programs/discussions at http://www.ni.com/support by searching in Option 3 for keywords like external, analog, output, and trigger.
    Hope this helps.
    Regards,
    John Nieri
    Applications Engineer
    National Instruments

  • Synchroniz​ing AI and Counter Tasks in DSA and M Series devices

    Hello DAQ fellows, I am new in the Counter field, so it would be really helpful to have your comments and advices about my application.
    I need to acquire simultaneouslythe following signals:
    - AI Voltage signal with a DSA device (PXI 4461).
    - AI voltage signal with a M Series device (PXI 6250).
    - Periods between TTL pulses signal with one counter of the same M Series device. I want to use the counter as it is shown in the figure 7-8 attached below.
    You can see my approach in the vi attached below (4461-6250ai-6250Ctr.vi). The 4461 is the master device.
    For the synchronization between both AI tasks I am using the "SampleClockTimebase" of the master device as a source for the 6250. I am also using the "StartTrigger" signal from the master device to trigger the start of the AI acquisition in the 6250. As I understand, this configuration is OK.
    Now come the second stage, which is to include the Ctr task to the acquisition process. I am creating the 3 tasks previously with another vi, the vi which creates the counter task (CreateTask6250Ctr.vi) is also attached. Now in the measurement vi (4461-6250ai-6250Ctr.vi), I use the "SampleClock" of the 6250-AI task in order to synchronize the AI with the Ctr task (I am not sure that this is the proper way to do this). Then I ask the "CounterTimebase.Source" in order to know which one is been used as SOURCE signal for the tick counting between the TTL pulses. Finally, I use the same "StartTrigger" signal from the master device to trigger the start of the Ctr task. In this way, when the AI task from the 4461 is started, it give the "StartTrigger" signal to the AI and Ctr tasks from the 6250 and the 3 start at the same time.
    What do you think. am I right with my approach?
    Is the Ctr task properly created to use the counter as in figure 7-8?
    Are the three tasks properly synchronized?
    Which other options do I have in order to synchronize the Ctr task with the other 2?
    Thanking in advance,
    Cristián
    Attachments:
    4461-6250ai-6250Ctr.vi ‏1561 KB
    Fig 7-8 from M SeriesUserManual.jpg ‏16 KB
    CreateTask6250Ctr.vi ‏35 KB

    Could I also use the PXI_Clk10 as a "ReferenceClock.Source" for the three tasks in order to synchronize them? I mean, instead of using the "SampleClock" of the AI task of the 6250 and the Ctr tasks of the same device. See the attachment to see what I mean.
    Greetings,
    Cristián
    Attachments:
    4461-6250ai-6250Ctr - PXI_Clk10.vi ‏1558 KB

  • Synchronization between counter and analogue acquisition

    To whom it may concern,
    I am developing a data acquisition in C# using DAQ card PCI-MIO-16E4, to acquire analogue and encoder readings.  However, the Analogue and Counter Acquisitions must be synchronized together through an internal clock.  I tried to create two tasks one for analogue and another for the counter.  Analogue channels and Counter to acquire pulses from the encoder (as up/down counter) were set accordingly.  The analogue timing was set to generate a particular square wave to be used as the sample frequency.  The timing for the counter task was set to be as “ai/sampleclock”.  Both tasks were started by calling the respective BeginReadMultiSample, with a separate asynchronous call back function.  The call back functions are called when the required samples were acquired, and will retrieve the respective samples by call the respective EndReadMultiSample.  The problem is that sometimes incorrect data is acquired.  Can someone help me in solving this problem or provide a working example with the minimum requirements?
    thanks in advance
    djg
    Message Edited by djgrech on 11-01-2005 12:24 AM

    Hi Tom W,
    Thanks for your email.  Well what I meant was that the counter and analogue data does not always seem to synchronize (there is a shift in the graphs, or the data is just erroneous).  This is not constant, so I am assuming that the acquisition is not well synchronized.
    I am attaching the code with this email; I am using counter 0 as the sampling frequency, counter 1 connected with the encoder for displacement acquisition (up/down counter), and analogue channels acquisition, in this particular case two.
    Is there a work around of how one can implement the sampling frequency to be internal?
    Thanks for your assistance
    djg
    PS good day
    Message Edited by djgrech on 11-02-2005 12:20 AM
    Attachments:
    AcquisitionForm.zip ‏12 KB

  • Need quick help, please!!! How do I scan the counter and analog channel in parallel, synchronized?

    Hi,
    I'm using LabView6.1 and a PCI6014 DAQ card.
    I have to scan simultaneously an analog channel and the counter on the card. My project requires me to measure in parallel a force (a voltage on an analog channel) in correspondence to a distance (measured with a counter) and I have to display a force-distance graph.
    So, can someone please tell me how can I program the counter and an analog channel to take 1000 measurements in parallel, and then, by reading the buffers to have two sets of corresponding measurements?
    I've tried some things and I've got only an error message, that says that there is no free DMA channel available (the error comes from configuring
    the analog channel). I attached one of these programs that gives this error, maybe somebody can tell me what I do wrong.
    If somebody could send me an example (in LabView6, I have no 7 :-( ), I would be grateful.
    Thank you,
    pixooxiq
    Attachments:
    Scan_Test_4.vi ‏177 KB

    Hi pixooxiq,
    unfortunately, your Card has only one DMA-Channel.
    If you want to use two Channels simutaneously, you have to tell one of them to use an Interrupt instead.
    This option can be set with the "Set DAQ Device Information.VI"
    Just see the Bitmap, I've attached.
    Perhaps, you now get Performance-problems, cause the IRQ does not directly write the Data but involves the CPU. In this case the only possibillity is to use an other card with more than 1 DMA-Channel...
    Regards
    Peter Weber
    NI Germany
    Attachments:
    Interrupt2.bmp ‏159 KB

  • Error synchroniz​ing calendar and contacts

    With the Desktop Software (version 6.0 package 2949) for my Macbook (OS 10.7.2) I want to synchronize my Blackberry 9700. My Blackberry is found by the softeware. After using the button synchronize I see " initialize synchronization engine" and soon an error occurs : " an error synchronize calender"; try again". I try again over and over but ... Can somebody help me out ?
    Henk
    Netherlands

    Hello hemiko and welcome to the BlackBerry Support Community Forums.
     KB24125 will address the error you are seeing with your sync.
    Based on that article it is advised you contact your mobile network carrier and ask this issue be transferred to Research In Motion to investigate further.
    Thanks!
    -HMthePirate
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Synchroniz​ing PC and Centro to install 3rd party software

    I stored software on my PC at folder Cokumente und Einstellungen/AS/Eigene Dateien/Palm OS Desktop/Holger/Install but when I activate the HotSync I get no installation on my Centro. Can anyone help?
    Post relates to: Centro (Unlocked GSM)

    I am trying to install "WEATHERBUG"  Weatherbug was allowed to run just fine on earlier versions of MOUNTAIN LION.  10.4 and later won't allow this 3rd party app to download.
    WeatherBug Alert for Mac helps you plan your day with confidence by putting severe weather alerts and your live temperature on your desktop.
    Features
    The most reliable weather information found anywhere.
    Severe weather alerts to help protect you and your family.
    One click access to radar, forecasts and more on WeatherBug.com
    Installation Intructions
    Download zip file.
    Copy file to Applications folder.
    Run the app.
    System Requirements
    Mac OS X version 10.4 or later
    Internet connection
    Support
    For support or to provide feedback on WeatherBug Alert for Mac, please visit the WeatherBug Alert Forum
    Click here for the OS X 10.3.9 Compatible Version
    FREE DOWNLOAD 
    WeatherBug Alert for Mac helps you plan your day with confidence by putting severe weather alerts and your live temperature on your desktop.
    Features
    The most reliable weather information found anywhere.
    Severe weather alerts to help protect you and your family.
    One click access to radar, forecasts and more on WeatherBug.com
    Installation Intructions
    Download zip file.
    Copy file to Applications folder.
    Run the app.
    System Requirements
    Mac OS X version 10.4 or later
    Internet connection
    Support
    For support or to provide feedback on WeatherBug Alert for Mac, please visit the WeatherBug Alert Forum
    Click here for the OS X 10.3.9 Compatible Version
    FREE DOWNLOAD 
    When I click install WEATHERBUG from the FINDER it get this message.
    "WeatherBug Alert" can't be opened because it is from an unidentified developer. 
    Your security preferances allow installation of only apps from the Mac App Store and identified developers.
    Safari downloaded this file today at 7:33 AM from wdownload.weatherbug.com.

  • How can i synchronize analog output and analog input timings to generate and measure voltage at the same time.

    how can i synchronize analog output and analog input timings to generate and measure voltage at the same time.

    Read this Tutorial
    http://zone.ni.com/devzone/cda/tut/p/id/3615#toc3
    And also refer to this link where You have repeated this question.
    PS: Please stick to one thread. That way, its easier to keep track of your query and answers

  • When using the analog inputs and analog outputs of the PCI-7344, what is the conversion between the voltage entering the card to counts? Similarly, what is the conversion between counts to voltage at the output of the card?

    I am using the PCI-7344 to control my system. The analog inputs are connected to the output of my system while the analog outputs serve as feedback to the system. The system is a servo. I want to know what is the conversion between the voltage read at the input, to card counts, and finally to the voltage output to the system.

    Carole,
    If you are trying to do analog feedback with a servo motor, Chapter 14 of the manual talks about how to set up the torque feedback. Also linked below is a LabVIEW example of analog feedback.
    Chapter 14
    NI-Motion User Manual
    Automatic Analog Feedback with FlexMotion example
    A. Talley
    National Instruments

  • Synchronization between PCI6722 and PCI6602

    I plan to synchronize counter PCI6602 and analog out PCI6722。6602 shares 6722’s ao/SampleClock as external clock and arm start triggered by 6722’s ao/StartTrigger。The master device is 6722, which refered as Dev1, and the slave device is 6602, which refered as Dev2. A RTSI line is used to connect the two devices correctly.
    I use C API to finish my program and my code is as follows:
    //config 6722 analog out task
    1、DAQmxCreateTask("NI6672", &hAOTask);
    2、DAQmxCreateAOVoltageChan(hAOTask, "Dev1/ao0", "", -10.0, 10.0, DAQmx_Val_Volts, "" );
    3、DAQmxCfgSampClkTiming(hAOTask, "", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000);
    4、DAQmxWriteAnalogF64(hAOTask, 1000, 0, 10.0, DAQmx_Val_GroupByChannel, data, NULL, NULL);
    //config 6602 counter task
    5、DAQmxCreateTask("NI6602", &hCounterTask);
    6、DAQmxCreateCICountEdgesChan(hCounterTask, "Dev2/ctr0", "", DAQmx_Val_Rising, 0, DAQmx_Val_CountUp);
    //use /Dev1/ao/SampleClock for external clock
    7、DAQmxCfgSampClkTiming(hCounterTask, "/Dev1/ao/SampleClock", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000);
    //use /Dev1/ao/StartTrigger
    8、DAQmxSetTrigAttribute (hCounterTask, DAQmx_ArmStartTrig_Type, DAQmx_Val_DigEdge);
    9、DAQmxSetTrigAttribute (hCounterTask, DAQmx_DigEdge_ArmStartTrig_Src, "/Dev1/ao/StartTrigger");
    10、DAQmxSetTrigAttribute (hCounterTask, DAQmx_DigEdge_ArmStartTrig_Edge, DAQmx_Val_Rising);
    //start counter task first
    11、DAQmxStartTask(hCounterTask);
    //start 6722 task
    12、DAQmxStartTask(hAOTask);
    I run it on the MAX virtual Device, and the Step 11 always returned error -89120。I try to slove this problem by changing the Step 7, use /Dev2/PFI9  instead of /Dev1/ao/SampleClock.
    7. 
    DAQmxCfgSampClkTiming(hCounterTask, "/Dev2/PFI9", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000);
    The code runs well, but I don’t know which terminal is connected by /Dev2/PFI9. Does it connect to /Dev1/ao/SampleClock?After that, I use another API DAQmxConnectTerms to ensure that, I add a Step before Step 11.
    DAQmxConnectTerms( "/Dev1/ao/SampleClock", "/Dev2/PFI9", DAQmx_Val_DoNotInvertPolarity );
    The program also run well. But I am still not sure that 6602 is sharing /Dev1/ao/SampleClock。If not, which terminal of Dev1 is connected by /Dev2/PFI9?
    Is my code right? If not, where's the problem? Is there any example code for me? Thanks!

    Hi Shokey,
    You may want to check into the DAQmxExportSignal function in the NI-DAQmx C Reference Help.  You can take a look at this post for more info on how to get there.  John explains, on this linked forum post, why this function is preferred to DAQmxConnectTerms.  Functionally, they work similarly, but DAQmxExportSignal is a little more convenient.
    That error may mean that you are trying to route something that is not available for routing, or that you may just have the name of your device mis-typed (based on what I've found.)  Searching the error code alone on ni.com, I found this KnowledgeBase online, which you may find helpful (whenever you are searching for an error code like -89210, type it in without the negative sign, as in "89120" into the search bar on ni.com)
    Using a Valid Terminal Produces Error -89120 at DAQmxStartTask
    To see where your device can and cannot route to, you can always look at the "Device Routes" tab in your Measurement and Automation Explorer   See this KB for information on how to do that:
    How Can I Know What Internal Routes are Available on My Device?
    Let me know if using these resources helps, or if I can clarify anything for you.
    Regards,
    Andrew
    National Instruments

  • Input and output task synchronisation

    Hello,
    I need to generate finite digital and analog signals with the same rate and I want to measure analog inputs 10 times faster at the same time
    Now it looks like that:
    Analog output clock is used to generate digital output at the same rate, I use analog output StartTriger to start Digital output and to start analog inputs.
    is this synchronised correctly? What do I need to write in rate for digital output signal?
    My another approach is to do finite acquisition:
    Now I  am generating nalog output lets say at 10Hz, signal has 100 elements so it will take 10s to generate. In the same time I will acquire at 100Hz for 10s so I will get 1000 samples. I am thinking correctly? 
    As far as I understand aoSample clock is created from 20MHz timebase. ant that is my 10Hz, so I can't acquire at faster rate using that clock? 

    Dear Pawel,
    in DAQmx, there are fundamentally two ways of synchronizing tasks. One is to share a Sample Clock between each task, thereby ensurning that each sample is generated/read at the same time. This only works when the sample rae is the same for all tasks, so in your case DO and AO can be synced like this.
    The other method is to share a Timebase and a Start Trigger between tasks. This allows for different speeds for each task, and thus is the suggested method for syncing AO and AI in your application.
    The exact way of doing the synchronization depends on he device(s) you have. Let me know if you need any further help.
    Regards:
    Andrew Valko
    National Instruments Hungary

  • Gated-event counting using analog triggers?

    I'd like to software trigger gated-event counting with analog signals. eg. Use a comparison to check analog input levels to a 6024E card, once a trigger level is reached send a digital out from the 6024E to a 6601 gate to commence and terminate a counter of the 6601 card.
    I have found that the counter on the 6024E card is not stable enough for this application, but the NI-TIO cards work reliably.
    Any tips greatly appreciated,
    Alan

    Alan;
    In case you want to trigger a finite pulse train generation of an analog hardware trigger, you can still accomplish that with an e-series board only.
    You will need to use both general purpose counters available on the DAQ device though. The first counter needs to be configured as retriggerable pulse generation, having its gate being routed to the AI Start Trigger pulse of the Analog Input task. With that done, the counter will generate a pulse at its output at every time the Analog Trigger level is met. You, then, configure the second counter to execute a continuous pulse train and route the first counter output to the second counter gate input. That will make the second counter to generate a pulse train that will be "enabled" by the first counter. The p
    ulse train will be generated while the output of the first counter is on its high state level.
    Knowing that, you can configure the pulse width of the first counter to be as wide as you need the second counter to generate the pulse train.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • Using counter and output at the same time

    Hi all,
    I'm using a NI 9401 high speed digital IO module (with a cDAQ 9174 chassis) that has 8 digital IO channels, to perform two tasks at once in Labview. I can get both of them to work independantly, but when I put them together to run simultaniousy in parallel, it does not work. My two tasks are simple: 1. Generate a continious pulse train square wave output using one of the counters linked to one of the output channels (PFI7) and 2. Output a 'high' (5V) with one of the other channels (PFI1)  when a certain logic condition is met.
    When I run my code (attached), the pulse train output works, but the output on the other channel doesn't work when the logic condition is met. I should note that the logic condition is that when RMS current exceeds 3A, I want to output a 'true'. I am measuring current using another analog input card connected to the same chassis and this part is all working well. I think the problem is that there is some sort of interference between the pulse train output which is linked to PFI7 and the other output which is PFI1.
    I know there is a limitation with the 9401 card that if the channels are in two groups, 0-3 and 4-7, and you must use a whole group as either all inputs or all outputs, but I don't think this should affect me, as I am using both my channels as outputs anyway, plus I am using channels 1 and 7 anyway.
    If anybody has any ideas as to what could be wrong with my code, I would greatly appreciate it.
    Attachments:
    DSDBI Vegetation testing program.vi ‏115 KB

    OK, you've shot yourself in the foot.
    It is a very bad idea to modify the shipping examples.  Like testing bungee cords by juming off a cliff-  sometimes you only get to try it once.
    Now why on earth did you not add the DI code following the example's method of wiring the error chain and closing the task after the loop?  You have duplicated code in both cases of your case structure the only difference.........(wait for it..........) There is a true constant in the true case where the false case contains a false constant.  A wait for task complete is unnecessary for a 1 sample DI task-  really the write just completes and the task stops all by itself.  the only needed thing here is a DI Write 1 Ch 1 Sample no case structure, and wire the compare output to data to write.
    You should probably add a control task vi with a "Reserve" input prior to each start task on the CO and  AI Tasks and after the Create Task on the DO.  Its a bit technical but the result is like taking vitamins- you'll just get better performance.
    Jeff

  • Several DAQmx Channels with Start and Clear Task VI's

    Hi,
    I'm trying to read in several DAQmx channels in a while loop. When I just place the channels within the while loop and connect them directly to the read VI's, everything is fine. But I read in the help, that this will slow down my system, because it's opening and closing the task each cycle. So I used Start Task and Clear Task VI's to open and clear them before and after the loop. But now it's only reading one of my channels in, although I wired all of them in exactly the same manner. Anyone has an idea, what I did wrong?
    Thanks,
    Miclas
    Attachments:
    Save&Stop DAQ.JPG ‏87 KB

    You would have seen the error if you had wired up and error indicator.
    You cannot run multiple tasks of the same type (i.e. an analog input) at the same time. What you read about stopping and closing tasks is correct but it was the only way your program could work. What you don't realize is that you can have multiple channels with a single task. If you used a physical channel constant, it would be something like 'dev1/ai0:2' if you had consecutive channels or 'dev1/ai0, dev1/ai2' for non-consecutive. Global channels are done in a similar fashion. You would have 'FSR1, FSR2, Knee Angle', etc.

  • Measuring frequency with counter or analog input?

    I have some frequencies which I need to measure. Some signals are digital and some are analog.
    I have a PXI-6040E DAQ which has both counters and analog inputs. 
    I heard that you can measure higher frequencies with the counters than with analog inputs.
    What is the range of frequencies an analog input can determine versus a digital counter? 
    Where is the cutoff that you must absolutely use a digital counter to determine the frequency?
    Is the cutoff different for different DAQ cards? Or is generally the same.

    Have you looked at the specs for the device? The max sample rate and the max counter input will be listed there. The max frequency for an analog input is based on nyquist sampling theory. Are you at all familiar with? It states your sampling frequency has to be at least twice the frequency you are measuring.
    Since each device might have a different max sample rate, your last question is answered.

Maybe you are looking for