02-06-2009 05:54 PM
My program is crashing when trying to use "niHSDIO_FetchMultiRecordU32" c-function.
I cannot find a pre-existing c example program that ships with the niHSDIO driver that uses this function.
here is the prototype from the niHSDIO.h include file:
ViStatus _VI_FUNC niHSDIO_FetchMultiRecordU32 (
ViSession vi,
ViInt32 samplesToRead,
ViInt32 maxTimeMilliseconds,
ViInt32 startingRecord,
ViInt32 numberOfRecords,
ViUInt32 data[],
struct niHSDIO_wfmInfo wfmInfo[]);
The help file says that this function "Fetches the data as a two-dimensional array of unsigned 32-bit integers and returns the number of samples read." How exactly should I declare this "two-dimensional" array?
When I fetch a single record using this function I have no problems:
niHSDIO_FetchMultiRecordU32(acq_vi, 524, 1000, 0, 1, &samp_data, &wfm_info);
But as soon as I try to fetch more than 1 record, my program crashes (and my exception handling routine won't even protect me):
niHSDIO_FetchMultiRecordU32(acq_vi, 524, 1000, 0, 2, &samp_data, &wfm_info);
I'm confident that my acquisition did acquire more than 1 record but not confident in the layout of the memory for the "samp_data" variable. I'm not using c, but accessing the DLL from another language. I may have an error in my variable declaration for the waveform data array.
Solved! Go to Solution.
02-06-2009 06:05 PM
I created a loop on niHSDIO_FetchMultiRecordU32, each time requesting the next record available but each time requesting only a single record be returned... this works fine.
But it seems less efficient than figuring out what i've done wrong with declaring the "two-dimensioned data array" variable.
02-10-2009 08:14 AM
Regards,
Dan King
02-12-2009 10:58 AM
Thank you Dan_K. I failed to find that example in my original browse through the examples.
As it turns out, my error was in the creation of the array of niHSDIO_wfmInfo needed to return waveform timing information... not the sample array.