NI9403:Acquisition & Génération bufferisée

Bonjour,
Je souhaite réaliser une acquisition / génération avec un module 9403 en cDAQ sous Visual C++.
J’ai modifié un des exemples NI DAQMX Ansi C (le code est ci dessous) de manière à initialiser la tache DI et la tache DO. Cependant, je suis confronté à un problème de routage de clock.
* ANSI C Example program:
* ContReadDigChan-ExtClk.c
* Example Category:
* DI
* Description:
* This example demonstrates how to input a continuous digital
* waveform using an external clock.
* Instructions for Running:
* 1. Select the physical channel to correspond to where your
* signal is input on the DAQ device.
* 2. Select the Clock Source for the acquistion.
* 3. Set the approximate Rate of the external clock. This allows
* the internal characteristics of the acquisition to be as
* efficient as possible. Also set the Samples to Read control.
* This will determine how many samples are read each time. This
* also determines how many points are plotted on the graph each
* iteration.
* Steps:
* 1. Create a task.
* 2. Create a Digital Input channel.
* 3. Define the parameters for an External Clock Source.
* Additionally, set the sample mode to be continuous.
* 4. Call the Start function to start the acquisition.
* 5. Read the waveform data continuously until the user hits the
* stop button or an error occurs.
* 6. Call the Clear Task function to clear the Task.
* 7. Display an error if any.
* I/O Connections Overview:
* Make sure your signal input terminal matches the Physical
* Channel I/O control. Also, make sure your external clock
* terminal matches the Physical Channel I/O Control. For further
* connection information, refer to your hardware reference manual.
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData);
int main(void)
int32 error=0;
TaskHandle DItaskHandle=0,DOtaskHandle=0;
uInt32 data[1000],dataOut[1000];
int32 sampsRead,totalRead=0;
char errBuff[2048]={'\0'};
int i;
// DAQmx Configure Code
DAQmxErrChk (DAQmxCreateTask("TacheDI",&DItaskHandle));
DAQmxErrChk (DAQmxCreateDIChan(DItaskHandle,"cDAQ1Mod8/port0/line0:15","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxCfgSampClkTiming(DItaskHandle,NULL,10000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk (DAQmxCreateTask("TacheDO",&DOtaskHandle));
DAQmxErrChk (DAQmxCreateDOChan(DOtaskHandle,"cDAQ1Mod8/port0/line16:31","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxCfgSampClkTiming(DOtaskHandle,NULL,10000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
// DAQmx Start Code
DAQmxErrChk (DAQmxStartTask(DItaskHandle));
for(i=0;i<1000;++i)
dataOut[i] = i;
DAQmxErrChk (DAQmxRegisterDoneEvent(DOtaskHandle,0,DoneCallback,NULL));
DAQmxErrChk (DAQmxWriteDigitalU16(DOtaskHandle,1000,0,10.0,DAQmx_Val_GroupByChannel,dataOut,NULL,NULL));
DAQmxErrChk (DAQmxStartTask(DOtaskHandle));
printf("Acquiring samples continuously. Press Ctrl+C to interrupt\n");
while( 1 ) {
// DAQmx Read Code
DAQmxErrChk (DAQmxReadDigitalU16(DItaskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,&sampsRead,NULL));
if( sampsRead>0 ) {
totalRead += sampsRead;
printf("Acquired %d samples. Total %d\r",sampsRead,totalRead);
fflush(stdout);
printf("\nAcquired %d total samples.\n",totalRead);
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( DItaskHandle!=0 ) {
// DAQmx Stop Code
DAQmxStopTask(DItaskHandle);
DAQmxClearTask(DItaskHandle);
if( DOtaskHandle!=0 ) {
// DAQmx Stop Code
DAQmxStopTask(DOtaskHandle);
DAQmxClearTask(DOtaskHandle);
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData)
int32 error=0;
char errBuff[2048]={'\0'};
static int count=0;
int i;
uInt32 dataOut[1000];
for(i=0;i<1000;++i)
dataOut[i] = i+count;
count++;
DAQmxErrChk (DAQmxWriteDigitalU16(taskHandle,1000,0,10.0,DAQmx_Val_GroupByChannel,dataOut,NULL,NULL));
// Check to see if an error stopped the task.
DAQmxErrChk (status);
Error:
if( DAQmxFailed(error) ) {
DAQmxGetExtendedErrorInfo(errBuff,2048);
DAQmxClearTask(taskHandle);
printf("DAQmx Error: %s\n",errBuff);
return 0;
Voici le message d’erreur obtenu:
Specified route cannot be satisfied, because it requires resources that are currently in use by another route.
Source Device: cDAQ1
Source Terminal: do/SampleClock
Destination Device: cDAQ1
Destination Terminal: Slot8/ConvertPulse
Required Resources in Use by
Task Name: TacheDI
Source Device: cDAQ1
Source Terminal: di/SampleClock
Destination Device: cDAQ1
Destination Terminal: Slot8/ ConvertPulse
Task Name: TacheDO
Status Code : -89137
Comment puis-je procéder pour effectuer à la fois une init de la carte en mode DI et DO avec la clock interne ?

Re jmali666,
Je vous renvoi vers le lien de la datasheet de ce module: Datasheet 9403
En fait vous ne pouvez cadencer matériellement que si vous ne faites qu'une lecture OU qu'une écriture comme il est spécifié dans la Datasheet.
Si vous faites les deux cumulées, alors il vous faudra cadencer logiciellement.
J'ai fait qlq tests (reproduction de votre erreur) sur labview et je vous le confirme. Veuillez trouvez ci joint des captures d'écrans.
Cordialement
Pierre_D
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
LabVIEW Tour
Journées Techniques dans 10 villes en France, du 4 au 20 novembre 2014

Similar Messages

  • Acquire data continuously (buffered semiperiod) with the 6602 board

    Hello,
    I post this qestion again because I think in my previous thread it will be wraped. :-)
    I use an PCI6602 card and 3 or 5 counters on it in buffered-semiperiod measurement.
    The planned measurement can last one day or longer so there will be a lot of values.
    What is the best way to process the values? Maybe calculate something and
    write these results to a file.
    I've read something about double buffered acquisition. Also something about
    a circular buffer.
    In the document "Lab VIEW Data Acquisition Basic Manual" the circular buffer is described.
    But I can't find any examples for double buffered acquisition and circular buffers.
    Has someone an example?
    Will I need such a t
    echnique? Or is there an other possible solution to handle the
    amount of data continuously?
    And when will be the best point of time to do the analyses of the data.
    Inside the while-loop or outside?
    Is it a problem to do this with the 3 counters simultaneously?
    I would be thankful for any tipps.
    I attached an file (library), where you can see the configuration (Measure Buffered SemiPeriod.vi).
    thanks in advance
    Peter
    Attachments:
    Measure_Buffered_SemiPeriod.llb ‏949 KB

    Peter,
    If your measurement will last for a day, you will need to log the data to file. Otherwise, it is very likely that you program will be unable to store that quantity of data. A double-buffered acquisition and a circular-buffered acquisition are the same operation. They refer to a continuous acquisition where a finite buffer is used in a circular fashion (new data is continually written over the current data as the buffer is filled). Of course, this requires the user to read data from the buffer before it is overwritten. In the program you attached to this post, you are already performing a double-buffered acquisition because you have the Buffer Mode controls set to "Continuous". With regards to analyzing this data, it would be best to do this
    after the acquisition is complete. Furthermore, you should be able to do this with three counters without any problems. Of course, if you need to perform more than three buffered measurements simultaneously, the additional counters will need to use interrupts.
    Good luck with you application.
    Spencer S.

  • TC measurements with PXI 4351 DAQ Card

    (I am using version 6i of LabVIEW). I am trying to create a VI that will use a PXI 4351 Card with a TBX-68T to take 4 thermocouple continuous measurements. I am also acquiring 8 voltages with a 6030E and TBX-68 and writing them to a file. My voltage data acquisition is modeled after "Buffered Continuous Analog Input.vi" I would like to aquire voltages and temperatures in the same vi, but using different devices and accessories. (I need a higher frequency for the voltage acquisition, and more precision with the temperatures). Is there a subvi I can use to collect the temperature data in the same vi as my voltage? I don't want the thermocouple DAQ to interfere with the voltage DAQ, either.
    I tried the NI435x thermocouple.vi
    but I couldn't get the Built-in Cold Junction Sensor to work or figure out how to combine it with my exisiting voltage acquisition. I also got NaN for my readings, and I checked the wire connections in all the sub vi's as suggested by another solution.
    Any comments would be great. Thanks in advance.

    Claudia-
    Thanks for the response.
    Regarding the CJC- When I switch it on, the temperature readings I get are very random, roughly negative 1 degrees. (I am operating right now at room temperature, and will be using J-type TC's to measure ~43 degrees C). Also, when I use the built-in CJC, the aquisition rate seems to slow down considerably. When I use the "user specified" everything seems to be ok, including the aquisition rate.
    I measured the resitance of the Thermistor on the TBX-68T and it was about 5000 Ohms, as expected.
    Just to make sure: When using the TBX-68T, do I need to hard-wire a thermocouple to Channel 1/auto-zero and another to channel 0/CJC? Because I connected a TC to channel 0 right now, but I wasn't 100%
    sure.
    I've attached my main vi and two sub vi's that I am using for the voltage aquisition part of my project. (Note:the current measurements are just voltage measurements multiplied by the recipricol of the resistance it was measured across, ie. 10).
    I would like to keep this file as is because it writes to a file exactly the way I want it to. I'd like to have the temperature aquisition with the 4351 in the same vi as the 6030E so that they both stop and start at the same time. I am just not sure how and where to log the temperature data since there will be fewer data points than the voltage data. Any suggestions? Should I write two separate files? can I somehow append them?
    Thanks again. Hope to here from you soon.
    Attachments:
    EBlackMainDAQ.vi ‏107 KB
    Save_Data8.vi ‏45 KB
    Build_String_Array5.vi ‏33 KB

  • Al Control Error

    Upon the finishing of the 'for' loop I get the following error --
    "10608 occured at Al Control
    NI-DAQ : No transfer is in progress for the specified resource"
    I get this error message, however, there is no error in the way data is obtained or saved. I know that if I get ride of the error handler, then this will not pause my execution at the end of each for loop. But it would be nice to keep it in my program so that if I get a error that effects my desired data aquisition I would know about it. If anyone knows why I am getting this error message and can help me get ride of it, it would be greatly appreciated.
    Thanks,
    Travis
    Attachments:
    On_Off_9.vi ‏350 KB

    In your while loop, you are performing two functions with your DAQ card (device #1): a buffered acquisition, and a non-buffered acquisition. You can't perform both of these at the same time. I suspect that you're setting up the buffered acquisition, then one of your non-buffered acquisitions runs, which sets up the card again. This will interrupt your buffered acquisition, giving you this error.
    You will either have to make your single point (non-buffered) acquisitions part of your buffered acquisition, and just look at a single point in the buffer to get your values, or you'll have to put your DAQ VI's in a sequence such that you don't perform both at the same time.
    Mark

  • How to implement Manager Selfservice - Recording Working Time - BP

    Hi!
    I would like to have a stepby step approach to implement business package for recording working time.
    What I need is the following information?
    1. Pre-requisites
    2. How to create the iview ?
    3. What R3 configurations need?
    you can email if you have good documentation on this to [email protected]
    Thank you
    Ramesh

    The primary limitation you will encounter when trying to do high speed
    digital I/O using your E-Series hardware is that the digital lines are
    all software timed.  This means that for each and every digital
    read it is necessary for your software to issue a command to your
    hardware, read a single point, then receive the response from the
    board.  This prevents you from performing digital operations at
    very high speed.  In general, I would say that 100 microseconds is
    a very good response using software-timed digital I/O on a Windows
    computer.
    It is difficult to make a good recommendation without more detail about
    what you are trying to do.  You may need to consider switching to
    a Real-Time operating system, or upgrading your DAQ hardware to a board
    that will allow you to time your digital acquisitions on the board
    itself.  These devices, such as the m-Series DAQ or the PCI-653x
    series, would allow you to use hardware triggers for your digital
    acquisitions, change detection, and buffered data acquisitions to
    reduce the software overhead involved in a rapid acquisition.

  • Develop & test a LabView program on a PC without DAQ card ?

    Hello,
    I am a LabView beginner.
    I would like to know if it is possible to develop & to test a LabView
    program for fast data acquisition (which uses double buffering) on a
    computer that have no a DAQ card.
    Many thanks in advance
    Francesco Di Maio

    I think see ur channel control string.It should include both index and channel number.may be u have entered config only ch0 not for others
    so increament ur ch index and ch number,
    I hope it will help u.
    Haider

  • Vici valve

    Bonjour,
    Pour mon projet j'ai besoin de contrôler une valve 2 positions (Vici Valco Instruments). Pour cela je dispose d'une interface digitale de la valve (DVI) qui me permet de contrôler la valve manuellement mais aussi de manière automatisé. Pour la communication avec l'ordinateur j'utilise un relais de marque superlogics type (8067 combiné avec 8025). Superlogics fournis sur son site web un programme "Utility 8000" qui me permet en l'exécutant indépendamment de Labview de contrôler la valve sans aucun problème ce qui signifie que la communication est bien établie.
    Comment puis-je incorporer "utility" dans un programme labview sachant que superlogics a fournis un vi?
    Ci-joint le vi "utility"
    Pièces jointes :
    _Utility.llb ‏85 KB

    Bonjour,
    Excuser moi de la confusion mais ces 2 VIs n'ont pas était fournis par le constructeur de la valve, mais par le constructeur du relais superlogics (8025 combine avec 8067). Je suppose que la carte d'acquisition/génération correspond au relais superlogics. Le driver NI-DAQmx est installé. J'ai déjà contacté superlogics est ils mon dit qu'ils n'ont aucune expérience avec LabVIEW est qu'ils ne peuvent pas m'aider.
    Ci-joint un programme que j'utilise comme modèle car le contrôle de cette valve a déjà été fait mais la personne qui a écrit ce programme a quitter le labo.
    Cordialement
    Japaris
    Pièces jointes :
    john breen program.vi ‏989 KB
    Shut Down JB 060509.vi ‏870 KB

  • Programme C++ et carte NI

    Bonjour,
    je dois effectuer un programme permettant le pilotage d'entrées sorties sur une carte National Instrument PCI 6905.
    Je n'ai encore jamais effectué ce genre de travail, aussi je cherche un exemple et surtout la bibliothèque à utiliser...
    Je développe en c++.
    A savoir que je n'ai pas encore la carte et que dés réception de celle ci je dois effectuer une démo... c'est à dire dans 5 jours.
    Je vous remercie pour toute aide et conseils !!
    Nicolas 

    Bonjour,
    Pour programmer une acquisition / génération avec votre carte PCI 6905 vous avez besoin du driver DAQmx
    Celui-ci est téléchargeable à cette adresse : http://joule.ni.com/nidu/cds/view/p/id/1614/lang/fr
    Une fois ce driver installé, vous allez trouver des exemples de programme en langage C (qui sera la même chose que le C++) en allant dans le menu démarrer » Programmes »National Instruments » NI-DAQ » Exemples » DAQmx ANSI C.
    Vous pourrez également simuler votre carte 6905 en utilisant l'utilitaire Measurement and Automation Explorer fourni avec DAQmx : Périphériques et interfaces DAQmx » Bouton droit : ajouter un périphérique simulé.
    En vous souhaitant une bonne journée.
    Cordialement,

  • [débutant] erreur 50103

    Bonjour à tous, 
    voilà je dois concevoir un banc d'essai d'endurance au cours de mon stage, j'ai donc une partie regulation de pression à l'intérieur d'une gaine avec un cycle de pression définie en face avant et pression atmosphérique, j'ai réalisé ce cycle à l'aide du Vi "simuler un signal arbitraire" (période 9s, pression définie sur 6s et 3s de pression atmosphérique), pour les compressions de cette gaine, j'ai tout simplement créé un Vi "simuler un signal arbitraire" directement relié à ma sortie DAQ de mon vérin, cycle de période 9s aussi que je souhaiterai synchroniser avec le premier. Tout ces cycles répétés x fois via une boucle for.
    Cependant mon problème "erreur 50103" me bloque, j'ai fait le tour de ce forum, mais je n'ai pas bien compris les explications données sur d'autre exemples, je débute avec labview et j'ai certaine zone d'ombre justement sur ces problèmes de nombre de voies, nombre d'échantillons ect...
    Merci d'avoir pris de votre temps pour lire, à bientôt en espérant recevoir une réponse.
    J'ai mis en pièces jointes le Vi de mon programme.
    Cordialement Tedd' Chap's. 
    Pièces jointes :
    Regulation et vérin.vi ‏322 KB

    Bonjour Tedd' Chap's,
    tout d'abord merci d'utiliser le forum National Instruments.
    Tu pourras trouver ici un document très complet sur l'erreur 50103. Vu ton code, je pense que tu te situes dans le cas 4. Il faut donc faire attention à deux choses : ne pas ouvrir simultanément plusieurs DAQ assistants pour accéder au même périphérique en "séquentialisant" le plus possible ton code (utiliser le flux de données en câblant les E/S d'erreur des VI express est un bon moyen pour cela), et bien stopper les tâches d'acquisitions/générations (en câblant l'entrée Stop des DAQ assistant ou en choisissant le bon mode d'acquisition).
    Malgré tout, je suis d'accord avec Titou, utiliser des vi de bas niveau de la palette DAQmx au lieu des assistants DAQ rendrait le code bien plus propre, surtout si tu dois mettre tout ça dans une boucle. Par contre, les VI de bas niveaux DAQmx ne te permettront pas plus que les assistants DAQ d'accéder à ton périphérique simultanément avec plusieurs tâches. Il faudra donc toujours définir un ordre d'exécution dans ce que tu souhaites faire.
    J'espère que ceci répond un peu à ta question.
    Bien cordialement,
    Audrey_P
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Journées techniques : des fondamentaux aux dernières technologies pour la mesure et le contrôle/comm...

  • How to reduce reading and recording data time/ Visual C++, PCI 6024E and PCI-MIO-16E?

    Right now I am working on a data communication programme. The time of reading digital signal and recording data is more than I expected, which is about 100 microsecond. I need to reduce the time. The software I am using is Visual C++ 6.0. I use two DAQ boards, which are PCI-6024E and PCI-MIO-16E. I have set the priority of Visual C++ to be realtime by task manager. The operating systme is Windows XP.
    I am wondering how to set the interrupt of reading or writing data to be the highest and stop any other kind of interrupt.
    Thanks in advance!

    The primary limitation you will encounter when trying to do high speed
    digital I/O using your E-Series hardware is that the digital lines are
    all software timed.  This means that for each and every digital
    read it is necessary for your software to issue a command to your
    hardware, read a single point, then receive the response from the
    board.  This prevents you from performing digital operations at
    very high speed.  In general, I would say that 100 microseconds is
    a very good response using software-timed digital I/O on a Windows
    computer.
    It is difficult to make a good recommendation without more detail about
    what you are trying to do.  You may need to consider switching to
    a Real-Time operating system, or upgrading your DAQ hardware to a board
    that will allow you to time your digital acquisitions on the board
    itself.  These devices, such as the m-Series DAQ or the PCI-653x
    series, would allow you to use hardware triggers for your digital
    acquisitions, change detection, and buffered data acquisitions to
    reduce the software overhead involved in a rapid acquisition.

  • SCXI-1112 aquires 1Hz other SCXI and PXI devices OK

    SCXI-1112 aquires slow, < 1Hz. I have an SCXI-1160, PXI-6602 and PXI-6052E in the same Chassis and they aquire > 100 Hz.

    Nardelli,
    Could you provide some additional details concerning your setup? The SCXI-1112 has a maximum sampling rate of 333 kS/s. Thus, most likely, the program that is controlling the hardware is determining the sampling rate. Which development environment are you using? What type of programming structure are you implementing with regards to the SCXI-1112? Single-point acquisition (software timed)? Buffered acquisition (hardware timed)?
    Spencer S.

  • Switch closure not detected at higher equipment speed

    I have a data aquisition stop switch programmed into my Labview VI that is an analog 0-5v signal. The switch itself is a magnet operated reed switch. When a magent passes the switch, it will momentarily open. Once the magnet has passed the switch the switch closes again. This causes the voltage to drop from 5 volts to 0 volts for a very short duration. This works well when the duration the magnet passed the switch is substantial enough to let labview read the momentary pulse. The switch is programmed into a while loop that performs the aquisition of 12 channels of data and some data analysis.
    However, the faster I make the machine operate the more often the program misses the stop data aquisition switch. Is there a way I can program labview to momentarily latch this switch long enough for the program to read it consistently regardless of the speed of the machine. A 1/2 second latch duration would be adeqate for my needs. I do know there is a way to do this with an electronic circuit , but I would prefer to do it Labview.

    Hello,
    I'm assuming from your message that you have a physically separate switch from your system (ie. not a relay on a plug-in board). I'm also assuming that you are reading the analog voltage from that switch using a DAQ board. This forum area is primarily for users of actual NI switching hardware (ie. relays on a plug-in board) and related software. I'll try to answer your question, but if it's not helpful you might want to try re-posting your message with a little more detail to the DAQ or LabVIEW forums.
    The answer to your question may depend a lot on how you are reading the analog input. Are you using single point values or are you using a continuous acquisition and examining the buffers as they come back. If you are using single point, the number of times that you can sample the channel will be reduced and the likelihood of missing the voltage change will be higher. By doing a continuous acquisition and then looking at the buffers for a change in state, you will have more determinism as far as your minimum time is concerned.
    Given that you have 0 and 5 volt levels, you might also be able to use a counter to count changes. If the count hasn't changed, no one has touched the button. If the count has changed, they have. This might be more reliable.
    There's probably a number of other ways to accomplish the same behavior. Again, if this doesn't help please feel free to post with a little more detail on what hardware you are using and how it is hooked up and I'm sure that someone can help!

  • How can I do a buffered digital acquisition on a single line?

    I am using a NI PCI 6110 DAQ and I need to do a continuous buffered data acquisition (sample rate near or above 5 kS/s). The thing is, the acquisition must be done on a single digital line. Some other lines of the digital port are used for something else (some in write mode, others in read), so they have to remain unaffected by the process.
    It would certainly be better if it could acquire data at the same speed as an analog input (which will be executing at the same time). In fact, it would have been much easier to only add a channel to the AI and I would have got exactly the results I want, but all the AI (4) of the board have already been used .
    The picture I uploaded shows what I'm tryi
    ng to do: I acquire analog data and I want to automatically show the moment a deconnection occured. The purple/pink line, which I added manually, is the one causing me trouble. It shows the voltage (0-5V) of the relay doing the deconnection (that's why it have to be done at the same time than an AI data acquisition).
    Thanks for reading this to the end
    Attachments:
    Graph.jpg ‏55 KB

    Well, you can't get hardware-timed DIO with the 6110, but you can probably use its counters to capture the timestamp you need.
    One method would be to set up a buffered edge-counting task. The analog input's sample clock would be specified as the source signal. This will cause the counter's value to increment at the beginning of each sampling cycle, acting as a measure of time from the start of analog input.
    The falling edge of the relay signal would be the counter's gating signal. For each instance that the relay disconnects, the count value ("time") at that instant will be stored in the counter's buffer for subsequent retrieval.
    Note one small timing subtlety: while the very first sample clock edge puts analog data into the 0th array inde
    x, it will also be incrementing the counter time to 1. This off-by-one deviation will persist.
    There are other variations on this theme, depending on whether you also need to capture re-connection times, or whether there is always one and only one disconnect of interest, etc. You can likely get just the behavior you need using one or both of the on-board counters.
    -Kevin P.

  • How to do multi-buffered acquisition on NI-6115

    I need to acquire multiple sequential arrays of data over a single channel using an external clock and a digital trigger (~1000 arrays total, 1000 samples/trigger, external clock frequency 500kHz, trigger frequency 250Hz). It is important that the sampling start right after every trigger, and that I do not miss any triggers. I can already do this using simple buffered acquisition with the ai start and ai read vis in a loop, except it misses triggers while the loop re-starts. Is there any way I can define a buffer large enough to hold all of the samples I need, then to have it read only the number of samples I want after each trigger into this large buffer? I don't need to see the data until the whole acquisition (1000 x 10
    00 samples/trigger) is over. Is this what multi-buffered acquisition does? I cannot find any literature on the NI site related to multi-buffered acquisition. Thanks for any help.

    So every 4 msec you get a trigger signal that should initiate a 2 msec acquisition (1000 samples at 500 kHz sampling rate)?
    There's an example of a way to use your board's counters to support retriggered analog acquisition here on the NI site: Retriggered Analog Input Example. The code may look a little complicated, but the basic idea is described pretty well.
    The goal is to make sure the timing is handled in hardware so you don't miss triggers while doing the software reprogramming. AI Start would be called only one time prior to your loop, and only AI Read would be calle
    d inside the loop.
    Just be careful about your timestamp info. The analog acq. task won't have any "awareness" of time intervals between samples. It'll be up to you to slice up the data into appropriate chunks. You can probably do this by simply requesting the right number (1000) from AI Read.
    Good luck,
    -Kevin P.

  • I am trying to write a double buffered data acquisition program using MFC and a callback function.

    i am trying to do a double buffer data acquisition using MFC application framework in Visual Studio.i want to use a callback function to notify when the buffer is half full.do you have some sample reference program that can help me?

    What DAQ board are you using? When you installed NI-DAQ you should have selected to install the support files for VC++. Then there will be several examples on how to do double buffered data acquisition.
    If you have already installed NI-DAQ 6.8 or higher and did not select to include the support files, you can run the NI-DAQ setup program and just add them. If you are using an older version, you will have to uninstall and reinstall.
    Once you have the support files, follow this path to the examples.
    >>Program Files>>National Instruments>>NI-DAQ>>Examaples>>Visual C>>
    If you are doing digital acquistion, goto the di folder, if you are doing analog acquisition goto the ai folder.
    As for the callback function, you can use the NI-DAQ function Config_DAQ_
    Event_Message with DAQEvent Type = 1, where N would equal half your buffer.
    Brian

Maybe you are looking for