Is fast streaming possible in Delphi

Post general discussions on using our drivers to write your own software here
Post Reply
Morris
User
User
Posts: 2
Joined: Tue Jun 16, 2009 10:56 pm

Is fast streaming possible in Delphi

Post by Morris »

I am trying to get fast streaming in Delphi to work, without success.
I have corrected the compile errors in the sample code and it works in block capture or standard streaming modes.

The relevant code for my problem is:

procedure TfmPS3000.StartFastButtonClick(Sender: TObject);
var
timebase : smallint;
no_of_samples : longint;
time_interval : longint;
time_units : smallint;
time_indisposed_ms : longint;
oversample : smallint;
max_samples : longint;
overflow : smallint;
no_of_values : longint;
GetResult : smallint ;
LoopCount : longint ;
LoopMax : longint ;
SampleCount : Cardinal ;
TriggeredAt : Cardinal ;
Triggered : smallint ;
StartTime : double ;
j : integer ;
lStr : string ;
BufferA : array[1..StreamingBufferSize] of smallint ;
BufferB : array[1..StreamingBufferSize] of smallint ;
BufferC : array[1..StreamingBufferSize] of smallint ;
BufferD : array[1..StreamingBufferSize] of smallint ;

begin
gBufferPtr := nil ;
gOverflow := false ;
gTriggeredAt := 0 ;
gTriggered := false ;
gAutoStop := false ;
gValCount := 0 ;
LoopCount := 0 ;
LoopMax := 1000000 ;
Entered := false ;


if ps3000_handle > 0 then
begin
Fast_collect := True;
lstResults.Items.Clear;
no_of_values := max_values;
timebase := 13;
ps3000_set_ets ( ps3000_handle, 0, 0, 0 );

{ set channel A off }
ps3000_set_channel ( ps3000_handle, 0, false, false, 10 );
{ set channel B on }
ps3000_set_channel ( ps3000_handle, 1, true, false, 10 );

ps3000_set_trigger ( ps3000_handle, 5, 0, 0, 0, 0 );

oversample := 1;

ps3000_get_timebase ( ps3000_handle, timebase, no_of_samples,
time_interval, time_units, oversample, max_samples );

GetResult := ps3000_run_streaming_ns ( ps3000_handle, 10, ptuMicroSec, StreamingBufferSize, 1, 1,15000 );

At this point, the run stops with a divide by zero error. I am fairly sure that is a misleading error indication and the problem is an illegal reference or similar.

ptuMicroSec equals 3

StreamingBufferSize = 100000

I would be grateful for help in resolving the problem.

Morris
User
User
Posts: 2
Joined: Tue Jun 16, 2009 10:56 pm

Added info

Post by Morris »

Sorry, I realised that I should show the declaration of my call back routine:
procedure SimpleFastStream(ovBufferPtr : pointer ;
overflow : smallint ;
TriggeredAt : Cardinal ;
Triggered : smallint ;
AutoStop : smallint ;
nValues : Cardinal ) ;
var dummy : integer ;
begin
Entered := true ;
try
gBufferPtr := ovBufferPtr ;
gOverflow := (overflow > 0);
gTriggeredAt := TriggeredAt ;
gTriggered := (Triggered > 0);
gAutoStop := (AutoStop > 0);
gValCount := nValues ;
except
end ;
end ;

Morris
User
User
Posts: 2
Joined: Tue Jun 16, 2009 10:56 pm

Re: Is fast streaming possible in Delphi

Post by Morris »

Yes it is (answering my own question).

I now have a fairly basic app which will set up the unit, collect streaming data, and store to disk.

I have not run it for much longer than a minute yet but it seems to work fine.

Post Reply