I tried to read data from the Oscilloscope using the routines ReadCh1 and ReadCh2 from the library PCSGU250.dll.
I used a Delphi-program to make the calls to the routines. But whenever the main program calls ReadCH1 or ReadCh2 it aborts with an exception message which points to the address ReadCh1 + 33. I’m using the Lazarus-IDE Version 1.6.4 for a Win32-platform.
I must admit that I am not familiar with Delphi and maybe i did something wrong. Any idea how to solve the problem?
Below, please find the code of my main program. The PCSGU250-software must be running before the program is started.
After start of the program, press e.g. the Single button in the oscilloscope window. Then, in the console wondow the message ‘Reading data from PCSGU250…’ is shown, but the message ‘Ready!’ does never appear.
program ReadDataFromPCSGU250;
uses SysUtils;
var
data1 : array[0…4999] of Integer;
p1 : Pointer;
t,t1,t2 : TDateTime;
function DataReady : Boolean; external ‘PCSGU250.DLL’;
procedure ReadCh1 (var p1 : Pointer); external ‘PCSGU250.DLL’;
procedure wait (var t : TDateTime);
begin
t1 := 86400.0Time();
t2 := t1;
while (t2-t1)<t do t2 := 86400.0Time();
end;
begin
t := 0.01;
Writeln(‘Waiting for new data…’);
while not(DataReady()) do wait(t); // every 10 ms ask whether new data is available
Writeln(‘Reading data from PCSGU250…’);
p1 := @data1[0];
ReadCh1(p1);
Writeln(‘ready!’);
Readln;
end.