Test and Measurement Forum

Problem with delphi dynamic array in using ADC-20

Post general discussions on using our drivers to write your own software here

Problem with delphi dynamic array in using ADC-20

Postby Samuel » Tue Dec 08, 2009 3:23 pm

I am writing my own software in Delphi using ADC 20 and I have a problem in streaming mode using the HRDLGetValues function with a dynamic array.
I think that the problem comes from this dynamic array.
Indeed, using the Delphi exemple project: HRDL.dpr given as exemple with the drivers and dll in the adc20sdk_r1_0_0 directory, if I declare the values array of the procedure TfmHRDL.trmSamplesTimer(Sender: TObject) as a dynamic array I get an access violation cause the values array is actually empty:

I replace the line

values : array [1..max_samples] of longint;

in the var declaration of the procedure TfmHRDL.trmSamplesTimer by

values : array of longint;

and then I set the length of this array just before calling the HRDLGetValues function:

SetLength(values,max_samples);
no_of_values := HRDLGetValues(hrdl_handle, values, overflow, max_samples);
//remembering that values now starts at 0 and not 1 anymore

I think I haven't done anything wrong so does anyone know if there are special things to set when using a dynamic array in this case or just if the use of these array is not possible?

Thank you
Samuel
Newbie
 
Posts: 0
Joined: Tue Dec 08, 2009 2:12 pm

Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 1 guest