PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
procedure TfmPS.ScopeInit;
var
status : smallint;
triggerconditions : pTriggerconditions;
channelpropertiesArray : pTchannelPropertiesArray ;
channelproperties : pchannelProperties;
begin
new(triggerConditions);
new(channelpropertiesArray);
New(channelproperties);
triggerConditions.channelA := 0 ;
triggerConditions.channelB := 0 ;
triggerConditions.channelC := 0 ;
triggerConditions.channelD := 0 ;
triggerConditions.channelExt := 1 ;
triggerConditions.aux := 0 ;
triggerConditions.pulseWidthQualifier := 0;
channelpropertiesArray[0] := 6000;
channelpropertiesArray[1] := 1024;
channelpropertiesArray[2] := 0;
channelpropertiesArray[3] := 0;
channelpropertiesArray[4] := 4;
channelpropertiesArray[5] := 0;
channelproperties.thresholdMajor := 6000;
channelproperties.thresholdMinor := 1024;
channelproperties.hysteresis := 0;
channelproperties.channel := 4;
channelproperties.thresholdMode := Level;
status := ps3000aSetTriggerChannelConditions(ps3000a_handle, triggerConditions, 1);
status := ps3000aSetTriggerChannelDirections(ps3000a_handle, 0, 0, 0, 0, 0, 0);
SetTriggerProperties(ps3000a_handle, channelpropertiesArray, 5, 1, 0);
// status := ps3000aSetTriggerChannelProperties(ps3000a_handle,channelproperties,5,1,2000);
Dispose(triggerconditions);
Dispose(channelpropertiesArray);
Dispose(channelproperties);
end;
procedure TfmPS.RunStream;
var
sampleTime : integer;
sampleInterval : integer;
begin
ps3000aSetEts(ps3000a_handle, 0, 0, 0, sampleTime);
ps3000aSetChannel(ps3000a_handle, 0, 1 {true}, 1{true}, 10,0);
ps3000aSetChannel(ps3000a_handle, 1, 0 {false}, 0{false}, 7,0);
ps3000aSetDataBuffers(ps3000a_handle, 0, @channelA, @channelAmin, 10000,0,0);
ps3000aSetDataBuffers(ps3000a_handle, 1, @channelB, @channelBmin, 10000,0,0);
{ start streaming }
sampleInterval := 400;
ps3000aRunStreaming(ps3000a_handle, sampleInterval, PS5000_NS,
0, 10000, 1{true}, 1, 0, 10000);
end;
procedure CallbackStreaming
( handle : smallint;
noOfSamples : integer;
startIndex : integer;
overflow : smallint;
triggerAt : integer;
triggered : smallint;
autoStop : smallInt; {boolean;}
parameter : Pointer
);
{$IFDEF WIN32} stdcall; {$ENDIF}
var
i : Integer;
begin
ready := true;
GstartIndex := startIndex;
streaming := not (autoStop = 1);
sampleCount := noOfSamples;
end;
procedure TfmPS5000.tmr1Timer(Sender: TObject);
var
i : integer;
begin
if streaming then
begin
ready := false;
ps3000aGetStreamingLatestValues(ps3000a_handle, CallbackStreaming, nil);
if (sampleCount > 0) and ready then
begin
for i := prev to (prev + sampleCount-1) do
begin
fmPS5000.iPlot1.Channel[0].AddXY(i,channelA[i-prev]);
end;
end;
prev := prev + samplecount+1;
end
else
begin
btnFastBlock.Enabled := true;
btnStreaming.Caption := 'Start Streaming';
ps3000aStop(ps3000a_handle);
end;
end;
Code: Select all
status := ps3000aSetTriggerChannelDirections(ps3000a_handle, 0, 0, 0, 0, 2, 0);
Code: Select all
SetTriggerProperties(ps3000a_handle, channelpropertiesArray, 1, 0, 0);
Code: Select all
btnStreaming.Caption := 'Stop Streaming';
ps3000aSetEts(ps3000a_handle, 0, 0, 0, sampleTime);
ps3000aSetChannel(ps3000a_handle, 0, 1 {true}, 1{true}, 10,0);
ps3000aSetChannel(ps3000a_handle, 1, 0 {false}, 0{false}, 7,0);
ps3000aSetDataBuffers(ps3000a_handle, 0, @channelA, @channelAmin, 10000,0,0);
ps3000aSetDataBuffers(ps3000a_handle, 1, @channelB, @channelBmin, 10000,0,0);
ps3000aSetSimpleTrigger(ps3000a_handle,1,channel_external,1000,ABOVE,10,2000);
sampleInterval := 400;
ps3000aRunStreaming(ps3000a_handle, sampleInterval, PS5000_NS,
5000, 5000, 0{true}, 1, 0, 10000);