Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI 6071E finite sample interval scanning

Solved!
Go to solution

Hi, 

 

We are considering using PCI 6071E to acquire data from a 64-pixel linear photodiode array. Assume we need to take 64x3 samples and our sampling rate is 1Ms/s (for 64 channels of AI), and each group of 64 samples are separated by a time interval T* (see attached picture). 

 

Platform: WIN XP OS, DAQmx with C++, Int CLK

 

For larger T* >50ms we can set the device to take 64 samples each time and reconfigure the device and prepare for next DAQmxReadAnalogF64. 

 

For smaller T* (say 2ms), the device may not be able to reconfigure fast enough that works correctly. One can think of  configuring the device to take 64x3 samples, and using external clocking (where we use a delayed digital pattern) to take care of timing

(see attached C++ code "void PDA::Acquire()", which can be modified to use ext. CLK),

but I am posting here in case any expert knows an easier way without adding hardware. 

 

The ideal solution we expect is to send one trigger for each set of 64 samples, and control the delay between each set of acquisition between triggers, but this may not be possible to achieve just using this device. 

 

Thanks very much in advance,

eLions.

Download All
0 Kudos
Message 1 of 19
(3,947 Views)

Hello eLions,

 

The PCI-6071E you are using for your application may not be able to multiplex fast enough to handle a T of 2ms which is why the device may not be able to reconfigure fast enough. However, based on the specifications you should be able to send one trigger for each set of 64 samples. 

 

NI 6070E/6071E Family Specifications

http://www.ni.com/pdf/manuals/370725c.pdf

 

Applications Engineer
National Instruments
0 Kudos
Message 2 of 19
(3,921 Views)

Hi Greg-H,

Thanks very much for your note. That's great. I checked the manual and it seems that ai/PauseTrigger will work? But I am not quite sure whether this is the right thing. Could you please give a hint or an example would be very helpful. Best regards,

eLions.

 

0 Kudos
Message 3 of 19
(3,911 Views)

Will the following code do the job?

 

DAQmxErrChk (DAQmxSetDigLvlPauseTrigSrc(taskHandle, "/Dev0/PFI0"));

DAQmxErrChk (DAQmxSetDigLvlPauseTrigWhen(taskHandle, DAQmx_Val_Low));

 

Then we control the digital pause trigger to PFI0 such that it is enabled for acquiring  64 samples each time. Then if the control pulse is not precise and synchronized well enough with the device clock, could it acquire either 63 or 65 samples?

0 Kudos
Message 4 of 19
(3,895 Views)

I found the following settings seem to work, but as mentioned above we need to get the PauseTrigger exactly right. Any suggestions that improves the task(so that precise timing is no longer essential) is greatly appreciated. 

 

--------------------------------------------------------------------------------------------------------------------

const extern unsigned short Npixel = 64, Nshot = 3; //PDA data size, 7 shots, 64 point each shot

 

void PDA::Acquire(unsigned short timeout) //Acquire PDA data
{
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else

int32 error=0;
TaskHandle taskHandle=0;
int32 read;
char errBuff[2048]={'\0'};
float64 shotdata[Npixel*Nshot];//data array to acquire in one shot


// DAQmx Configure Code
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev2/ai0","",DAQmx_Val_RSE,-5.0,5.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,NULL,CLK,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,Npixel*Nshot));
//DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev2/PFI0",DAQmx_Val_Rising));
DAQmxErrChk (DAQmxSetPauseTrigType(taskHandle, DAQmx_Val_DigLvl));
DAQmxErrChk (DAQmxSetDigLvlPauseTrigSrc(taskHandle, "/Dev2/PFI1"));
DAQmxErrChk (DAQmxSetDigLvlPauseTrigWhen(taskHandle, DAQmx_Val_High));
DAQmxErrChk (DAQmxTaskControl(taskHandle,DAQmx_Val_Task_Commit));

// DAQmx Start Code
DAQmxErrChk (DAQmxStartTask(taskHandle));
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,Npixel*Nshot,timeout,DAQmx_Val_GroupByChannel,shotdata,Npixel*Nshot,&read,NULL));
cout<<"PDA::64x"<<read/64<<" samples taken"<<endl;

Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
}

0 Kudos
Message 5 of 19
(3,879 Views)

My appologies, the code readability for the above post is fairly low. Please check the attached document. 

The function:

void PDA::Acquire(unsigned short TimeOut) //Acquire PDA data

has the settings that seems to work. 

 

The example takes a 16x3 data set. 

0 Kudos
Message 6 of 19
(3,871 Views)

eLions,

 

Just to make sure I understand exactly what you are trying to do:

 

1.  You have 64 analog lines you are sampling

2.  You sample all 64 channels at the same time

3.  You repeat this three times with a specific time interval in between

4.  After these three set of data are collected you wait another amount of time and then repeat the process

 

The problem you are seeing is that at small time delays in between the sample sets (4) the program is not behaving as you would like.

 

If anything I have said is incorrect please let me know.  This will allow me to make better recommendations for your application.

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
0 Kudos
Message 7 of 19
(3,864 Views)

Hi Greg H.,

Thanks for you reply.

 

1.  You have 64 analog lines you are sampling

A: Yes

 

2.  You sample all 64 channels at the same time

A: Yes. Since 6071E is not a parallel analog input device, internally on the device, for the first 64 samples it scans from channel 0 to channel 63.

 

3.  You repeat this three times with a specific time interval in between

A: Yes, the specific time intervals may vary, for example, after first set of 64 samples we wait 2ms; after 2nd set of 64 samples we wait 8.5ms, etc;

 

4.  After these three set of data are collected you wait another amount of time and then repeat the process

A: Yes. After step(1)~(3), we wait for a few seconds and repeat the process, this is long enough so that we can reconfigure and restart the device. 

 

The potential problem I am seeing now is to do what I implemented above-using a pause trigger to pause acquisition for the desired time interval in step (3), we will have to match the pause trigger precisely so that for each set we do take 64 samples (other than 63 or 65).

 

Please let us know whether you think I said make sense, and your suggestions are greatly appreciated.

 

As I mentioned in the very first post, if by means a easier and reliable solution exists, then we will go and make an external update clock for the device, whose timing is completely taken care of by external timed update clock.

 

Best,

eLions

 

0 Kudos
Message 8 of 19
(3,860 Views)

eLions,

 

The pause trigger will do the trick.  If you try to use a wait in the loop then the software will simply stop grabbing data from the buffer, however the card is going to continue to fill up data in FIFO buffer, thus when u start grabbing data from the buffer again you will be getting older data.  Using the analog pause will prevent this from happening and the samples you take will be the latest.  The actual time the task begins again will still be based on the software speed, i.e. just because you put a three ms wait before you start the task again does not guarantee it will be exactly three ms.  You will not need to worry about the pause trigger being matched exactly to avoid the 63 or 65 samples.  You can set the analog read to grab one sample from each channel and then have it pause.  You can then start the sample grabbing again then pause and continue this process.  I would clear the buffer after the pause.

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
0 Kudos
Message 9 of 19
(3,843 Views)

Hi Greg H.,

 

Thanks for your reply. I will try to change it to analog pause trigger and set the channels to read one sample per channel each time, and clear it after. But I am confused by the following: 

 

"The actual time the task begins again will still be based on the software speed, i.e. just because you put a three ms wait before you start the task again does not guarantee it will be exactly three ms. "

 

Assume our software speed is very high and is not a limitation, and I hope to wait 3ms between successive acquisitions (say the acquisition takes 1ms), how do I implement it? Using software wait 3 ms is certainly not a good situation since it may vary from shot to shot; or are you referring to the case where we send a start trigger every 4ms?  

 

Best,

eLions

 

 

 

0 Kudos
Message 10 of 19
(3,841 Views)