05-25-2009 05:48 PM
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?
05-26-2009 02:59 PM
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