Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to timestamp continuous analog data acquisition using USB-6009 and GPS timing board?

NI USB-6009, NI-DAQmxBase 2.0 (ANSI C), Windows XP, C++ Builder

 

A research group has developed a data acquisition system of solar radio waves. A spectrum analyzer (HP8559-A) sends sync and data signals to the USB-6009 connected to the PC. The falling edge of the sync signal indicates the start of a scanning. When a start is detected, the analog data signal must be digitalized during 5 ms until the next rising edge (Figure).

 

 

A software must acquire 100 samples of the data signal per scanning and store samples on a file during 5 minutes. When the acquisition ends, other acquisition restarts storing samples on a new file, and so on, for several hours until the user stop the execution. After, each file will be visualized as a solar data image (Figure).

 

 

Current Software

 

A previous developer sets up the DAQ task in order to acquire samples of sync (Dev1/ai0) and data (Dev1/ai1) signals in continuous mode, with sample rate of 20 kS/s during 5 minutes. Sync and data samples are read and stored on a file. After, invalid data samples (when sync samples is in high level) and all sync samples are removed of the file. A new acquisition restarts on each 5 minutes, and so on until the user stop the execution. This acquisition software is operating successfully. (see code attachment) 

 

Data Acquisition with Timestamps

 

However, we need timestamp the solar data at the beginning (and, if possible, at the end) of each scanning. So I need get timestamp at the falling edge of the sync signal (and, if possible, at the rising edge) (see first figure).

 

In order to read the UTC time (hh:mm:ss.sss UT) with time resolution of 1 ms, we want to buy a GPS timing board �TSAT-PCI U�. This board includes a time-tag TTL input to timestamp external events. When the rising edge of the time tag input occurs, the timestamp is loaded into the FIFO. 

 

JoshuaP has suggested the NI-PCI 1588, but it needs an external GPS. Nevertheless, we will choose the lowest cost hardware (TSAT-PCI U or NI PCI-1588 + GPS ???).

 

I don�t have experience with USB-6009, then I would appreciate suggestions to solve this problem. How to timestamp data acquisition using USB-6009 and GPS timing board? We have two USB-6009 (one board operating and one spare board) that were acquired a short time ago and we would like to use them.

 

If it is not possible, which board (PCI-6010 B-Series, PCI-6221, USB-6210, USB-6211) is adequate? The PXI-6608 is expensive for our project. How to use digital triggers, counters or digital outputs in order to acquire data and generate external events for the GPS timing board?

 

Regards,

Lilian

Msc. Computer Science



Message Edited by Lilian NF on 04-24-2008 01:43 PM
0 Kudos
Message 1 of 4
(7,448 Views)

Lilian,

The USB-6009 does not have a PFI output to generate a trigger signal for the PCI-1588, it could be done using the digital output by software, but the signal would suffer a little delay that would compromise the time stamps.

The best way to accomplish what you need is with NI-6010 or another card with PFI output to send the start trigger on the falling and rising edges to the PCI-1588 to get the time from the GPS and to start scanning and storing the samples.

The USB-6009 would not be used with your application. The trigger and data acquisition would be made using the PCI-6010.

To Time your application you could use NI-Sync Driver. More information about the driver can be found below:

http://digital.ni.com/manuals.nsf/websearch/B77F9934734D9EAA8625732B0062750C

 

Dario Camargo

NI Brazil

#1152141

0 Kudos
Message 2 of 4
(7,374 Views)
Dario,

During the interval between DAQmxStartTask (PCI-6010) and niSync_EnableTimeStampTrigger (PCI-1588),
could the device begin to acquire samples during 5 minutes without the first timestamp (falling edge of the sync signal)?

If this occurs, I will obtain all the timestamps with an error of 5 ms.

Am I routing the trigger to the PCI-1588 correctly in the code below?

Regards,
Lilian  



/*
   PCI-6010
         "/Dev1/ai0"                              -  Analog Input Channel
         "/Dev1/Ctr0InternalOutput"     -  AI Sample Clock
         "/Dev1/ctr0"                            -  Counter used to Generate Pulses
         "/Dev1/PFI0"                           - Trigger Input
         "/Dev1/PFI6"                           - Trigger Output

  PCI-1588
         "PXI3::4::INSTR/PFI1"             - Timestamps trigger input
*/


niSync_init (..., &vi);
niSync_SetTimeReferencePPS (vi, "PXI3::4::INSTR/PFI0", ...);   

DAQmxCreateTask (..., &analogInTask);     
DAQmxCreateTask (..., &counterOutTask);     

DAQmxCreateAIVoltageChan (analogInTask, "/Dev1/ai0", ...);
DAQmxCfgSampClkTiming (analogInTask, "/Dev1/Ctr0InternalOutput", ...);

// retriggering for AI task
DAQmxCreateCOPulseChanFreq (counterOutTask, "/Dev1/ctr0", ...);
DAQmxCfgImplicitTiming (counterOutTask, ..);
DAQmxCfgDigEdgeStartTrig (counterOutTask, "/Dev1/PFI0", ...);    
DAQmxSetTrigAttribute (counterOutTask, DAQmx_StartTrig_Retriggerable, ..);

// PCI-6010 ("/Dev1/PFI6") -> PCI-1588 ("PXI3::4::INSTR/PFI1")
DAQmxExportSignal (counterOutTask, DAQmx_Val_StartTrigger, "/Dev1/PFI6");

do{     // start a new acquisition

    ...
    
    // open a new datafile
       
    DAQmxStartTask(counterOutTask);
    DAQmxStartTask(analogInTask);

    niSync_EnableTimeStampTrigger (vi, "PXI3::4::INSTR/PFI1", ...);

    // data acquisition during 5 minutes
    while( ... )
    {
        DAQmxReadAnalogF64(analogInTask, ...);

        niSync_ReadMultipleTriggertimestamp (vi, "PXI3::4::INSTR/PFI1", ...);

        // store on the datafile
        
    }

    niSync_DisableTimeStampTrigger (vi, ...);

    DAQmxStopTask(analogInTask);
    DAQmxStopTask(counterOutTask);

    // close datafile

    // organize datafile

}while(!stop);




Related Link:

Retriggerable Analog Acquisition in NI-DAQmx


0 Kudos
Message 3 of 4
(7,192 Views)

Lilian,

You will have to test and debug the code yourself.

We cannot check codes to see if it will fit your application or not. If an error related to our drivers or card occur we can help and point you on the right direction.

Dario Camargo

NI Brazil

0 Kudos
Message 4 of 4
(7,170 Views)