Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make a synchronous acquisition

hi
          im using the pci-mio-16E1 card, with the IDE VC++, so  im looking for an example to explicate me how to make an synchronous acquisition data using an external timing, so the idea is to acquire the data frum the  input channel at each  tigger,and saving  the data in a file memory .
tanke you for your help.
0 Kudos
Message 1 of 7
(3,975 Views)
Do you mean that you want to take a single data point for each trigger pulse?

Are you using NI-DAQmx?

If the answer is Yes to both questions, take a look at the documentation for DAQmxCfgSampClkTiming(), and specify an I/O connector pin for the source parameter, something like "/dev1/pfi7" (pfi 7 on that board is also called AI SAMP CLK).

There is an example in the NI-DAQmx Examples, Analog In\Measure Voltage folder, called ContAcq-Ext Clk-Dig Start. I haven't looked at it, but the name sounds about right.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 2 of 7
(3,961 Views)
yes i mean that i want to take a single data point for each trigger pulse.
but i dont use the NI-DAQmx.
so to see and understand my problem you can see my code :
 
 
iStatus = Timeout_Config(iDevice, lTimeout);
         iRetVal = NIDAQErrorHandler(iStatus, "Timeout_Config", iIgnoreWarning);
 
 
   //  configuration and selection of  signal trigger   
 
         iStatus = Configure_HW_Analog_Trigger(iDevice, ND_ON, iLowValue,iHighValue, ND_ABOVE_HIGH_LEVEL, ND_THE_AI_CHANNEL);
   
        iRetVal = NIDAQErrorHandler(iStatus, "Configure_HW_Analog_Trigger", iIgnoreWarning);
    
 
  iStatus = Select_Signal(iDevice, ND_IN_CONVERT, ND_PFI_2,ND_HIGH_TO_LOW);
    
         iRetVal = NIDAQErrorHandler(iStatus, "Select_Signal", iIgnoreWarning);
    
    iStatus = AI_Setup(iDevice, iChannel, iGain);
   iRetVal = NIDAQErrorHandler(iStatus, "AI_Setup", iIgnoreWarning);
  
   while ((iReadingAvail != 1) && (iStatus == 0)) {
      
 /* Wait until reading is available. */

         iStatus = AI_Check(iDevice, &iReadingAvail, &iReading);
       
        iRetVal = NIDAQYield(iYieldON);
    }
 
       //  Acquire data from a single channel 
 
    iStatus = DAQ_Op (iDevice, iChannel, iGain, piBuffer, ulCount, dSampRate);

 
   while ((iDAQstopped != 1) && (iStatus == 0)) {
   
        iStatus = DAQ_Check(iDevice, &iDAQstopped, &ulRetrieved);
         
        iRetVal = NIDAQYield(iYieldON);
      }
  
 
       iStatus = DAQ_VScale(iDevice, iChannel, iGain, dGainAdjust, dOffset,ulCount, piBuffer, pdVoltBuffer);
  
      iRetVal = NIDAQErrorHandler(iStatus, "DAQ_VScale",iIgnoreWarning);
   

   /* Set analog trigger mode back to initial state. */
       iStatus = Configure_HW_Analog_Trigger(iDevice, ND_OFF, iLowValue,iHighValue, ND_ABOVE_HIGH_LEVEL, ND_THE_AI_CHANNEL);
   
 
  /* Set PFI line back to initial state. */
       iStatus = Select_Signal(iDevice, ND_IN_START_TRIGGER,ND_AUTOMATIC, ND_DONT_CARE);
 
 
 
 
          iStatus = DAQ_Clear(iDevice);
  
 
 
 
 /* Plot acquired data  */
   
      iRetVal = NIDAQPlotWaveform(pdVoltBuffer,ulCount, WFM_DATA_F64);
    
so this is the data acquired -0.900879,-0.900879,-0.900879,-0.900879,-0.900879,-0.900879,-0.900879,-0.900879 and i think that is a noise because all time i get this data.
tank you very mutch fo your help.
0 Kudos
Message 3 of 7
(3,950 Views)
>so this is the data acquired -0.900879,-0.900879,-0.900879,-0.900879,
>-0.900879,-0.900879,-0.900879,-0.900879 and i think that is a noise
>because all time i get this data.

Ah. So you are getting some sort of data. More detail in the first posting would have been helpful.

If I understand your problem now, the code is working correctly but the data are meaningless. You don't show the initialization of the variables, like iChannel or ulCount, so I can't tell what those are set to. You also don't show how the board is set up.

Is the channel set up as a differential, or single-ended input? What pins did you connect the signal to? Are you certain that you have a good signal connected to the input? Have you checked the cables to make sure they are not broken or loose? Can you connect a known good signal to the input to test it?
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 4 of 7
(3,948 Views)

hello   (im frenchy speak )

the last code work correctly; but now im changing the code because  im looking to get in the acquisition a one sample for each trigger pulse

i will show you this code


  so this code work correctly and i explicate you how is work : see that in the  attached piece

im using the function scan_start (function of acquisition of  multi_channel: but im using just one channel) to make a période triggring to make the acquisition for each pulse trigger and the the sapmle rate is at ( dSampRate= 1 )  this is posted me an error message """"" -10697:  rateNotSupportedError Unable to convert your timebase/interval pair to match the actual hardware capabilities of this board. """"

and if we change for example the rate at (dSampRate=1000) it work with not error but at the same time i can't get for each trigger pulse one sample acquisition data.

i hope that you are understanding my problem . so if you know a function that make this acquisition tel me it.

thx for help.

0 Kudos
Message 5 of 7
(3,901 Views)
chemssou,
It sounds like you want to do retriggerable analog input acquisition.  This is not natively supported by your data acquisition board.  However, there are some things you can try if you want to attempt to do retriggerable acquisition.  I would also highly recommend using the DAQmx API, as it is much more powerful and easier to use than the Traditional DAQ API.

If you are using a digital trigger you can simply use the trigger as the source clock for your acquisition by specifying that you want to use an external sample clock.  There are several shipping examples in Traditional DAQ as well as DAQmx that use an external source clock.  One such example for Traditional DAQ can be found at C:\Program Files\National Instruments\CVI71\samples\daq\Ai\DAQsingleBufExtConv.C  If you are using DAQmx the example
ContAcq-Ext Clk-Dig Start mentioned in the 2nd post by John Weeks would work well.

This method only works if you want to do a single point acquisition with every trigger.  A more common way to do retriggerable acquisition is to use the counters on your board to do retriggerable pulse train generation, and use the output of these counters as the source clock of your analog input acquisition.  This technique is documented in the following example.

If you are using an analog trigger, then basically your only option is to put all of your code in a big while loop, reconfiguring the task every iteration of the loop.  You could have an array that is external to the loop which you would write to from within the loop with each sample that you acquire.  The major drawback to this method is that you have the overhead of configuring your task on every iteration of the loop, which is slow.  If your triggers happen too quickly, there is no guarantee that you will catch every sample because a trigger may occur while the task is reinitializing.

I hope these ideas help!

Doug M
Applications Engineer
National Instruments
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 6 of 7
(3,877 Views)
chemssou,
In my previous post, I should have given the following as the path to the example: C:\Program Files\National Instruments\NI-DAQ\Examples\VisualC\Ai\
DAQsingleBufExtConv.C

Good luck!

Doug M
Applications Engineer
National Instruments


Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 7 of 7
(3,873 Views)