LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

timing problem application using DAQmx functions

Hi Jos,

Correct. The speed limitation is not the DAQmx driver. The equivalent PCI-6251 is also limited to 1.25 MS/s (1-channel) or 1 MS/s (multi-channel), so that’s the limit of this particular product family. A 3-year old computer should be able to handle this amount of data, depending on how often overhead operations, such as reading data, are performed. If you are calling a read function for every sample, that is going to create a lot of unnecessary overhead that could slow down any computer.

The last point I want to make is that the sampling rate of 1.25 MS/s seems to be a USB limitation as indicated by this page, found from www.ni.com/dataacquisition by clicking on “Compare Product Families” in the upper left.

 
Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 11 of 16
(1,986 Views)

Hello Mark,

Thanks! I know now enough to (let) buy me some new toys.

Regards, Jos

 

0 Kudos
Message 12 of 16
(1,979 Views)
Hi! i've got a question concerning the DAQmx functions : I'm using the DAQmxReadDigitalU32 and DAQmxWriteDigitalLines functions to emulate an SPI memory. Is there any embeded buffer on the PCI 6533 board witch I can use to accelerate the execution of these functions?
I know that it works with buffers located into the RAM of my computer, but I would like to put these onto the board (to reduce latency between function calls). In do not know if it is clear enouth, sorry for my approximative english.

Pierre
0 Kudos
Message 13 of 16
(1,838 Views)

Hi Pierre,

I’m assuming that since you are trying to emulate a SPI memory you have a read, write and clk line. The clk line controls the timing for when you need to read and write. For your digital read and write tasks what type of timing are you currently using?

 I would recommend trying a continuous acquisition with an external sample clock. In this case the sample clock could be the spi clk line. This way your read and writes are hardware timed and you can possibly run your application faster. This will also force your card to use its built in buffers to store data before outputting it or writing it to buffers in the computer’s memory.

Below I’ve included the path to a couple of examples that show how to set up a digital task for continuous external clk acquisition. The examples should be at these locations on your computer. They were installed with the DAQmx drivers.

Continuous Digital Read – External CLK


C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Read Values\Cont Read Dig Chan-Ext Clk

Continuous Digital Write – External CLK


C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Generate Values\Cont Write Dig Port-Ext Clk

Let me know if you have any questions and have a great week.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 14 of 16
(1,803 Views)
Hello Nathan,
Thanks for these examples you gave me, I used those in a good way and it reduces the latency time (but not so much). I think there is an other way to solve my problem : is it possible to run execute two differents tasks (one reads, and the other one write)at the same time, timed with the same physical sample clock?

Here is a part of my code

        char        chan[256] = "Dev1/port2/line0:7",clkSrc[256] = "/Dev1/PFI3", clockSource[256] = "/Dev1/PFI2";
        DAQmxErrChk (DAQmxCreateTask("",&gtaskHandle));
        DAQmxErrChk (DAQmxCfgInputBuffer (gtaskHandle, 0));
        DAQmxErrChk (DAQmxCreateDIChan(gtaskHandle,chanIN,"",DAQmx_Val_ChanPerLine));
        DAQmxErrChk (DAQmxCfgSampClkTiming (gtaskHandle, clockSource, rate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 16));

        DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
        DAQmxErrChk (DAQmxCfgOutputBuffer (taskHandle, 0));
        DAQmxErrChk (DAQmxCreateDOChan(taskHandle,chan,"",DAQmx_Val_ChanPerLine));
        DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,clkSrc,rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,numSamps));
        gData = malloc (128*sizeof(uInt32));

        DAQmxErrChk (DAQmxStartTask(gtaskHandle));
             //READ//
            DAQmxErrChk (DAQmxReadDigitalU32(gtaskHandle,gSampsToRead,10.0,DAQmx_Val_GroupByChannel,gData,8*gSampsToRead,&sampsRead,NULL));
        DAQmxStopTask(gtaskHandle);

        DAQmxErrChk (DAQmxWriteDigitalLines(taskHandle,numSamps,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));
        DAQmxErrChk (DAQmxStartTask(taskHandle));

Regards,
Pierre
0 Kudos
Message 15 of 16
(1,771 Views)

Hey Pierre,

As long as you are not trying to read and write from the same line then both tasks can be started at the same time.

Also they can both use the same sample clock. Just specify the same sample clock source for both tasks in each tasks’ DAQmxCfgSampClkTiming function. With the same source selected and both tasks started at the same time. When you have a rising edge on the sample clock it will read a sample from the read line and write a sample to the write line.

Let me know if you have any questions. Take care.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 16 of 16
(1,735 Views)