Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Edge counting buffer/array size problem (VC++)

Hello,

 

I am attempting to do a buffered edge counting with PCI-6115 for the application I am trying to develop.

 

Ideally, I would initialize a buffer array, then use a sample clock to time and acquire counter values which would then be stored in a buffer.  After a certain number of samples, I would then use the DAQmxReadCounterU32 function to extract the said data and perform some calculations.

 

However, windows gives me an error when I try to initalize the size of the buffer array to be larger than 255001, I need 264000+.

 

Essentially, only this part of the code seems to execute:

 

int         error=0;

TaskHandle  taskHandle=0;

TaskHandle  taskHandleCtr=0;

uInt32      data[260000];

 

After that my program crashes with a popup asking me if i want to send an error report to Microsoft.

 

Would this be a problem of windows not allowing me to allocated more than 255000 32 bit samples for that array?  If so how do i put the array onto the onboard memory?

 

 

0 Kudos
Message 1 of 2
(2,938 Views)

Hi HT156,

 

I believe you may have reached the limit of the Stack Frame of your compiler.  You could try adjusting the limit in your compiler's settings or loading the array dynamically (see the second solution in the following external forum: Is there a max array length limit in c++?).

 

On the other hand, you don't necessarily need to read all 260000 samples at once.  Putting DAQmx Read inside a loop and calling multiple times would bring over less data per call to DAQmx Read.  I'm not sure what you are doing with the data, but it may be beneficial to breakup the data into smaller pieces as you read it in (for example, to update a graph more quickly).

 

-John

John Passiak
0 Kudos
Message 2 of 2
(2,910 Views)