I can get it to connect, and run in streaming mode. When I try to use block mode, it triggers OK but never becomes ready for me to collect the data.
I've included the function declarations as comments as I suspect something is wrong there.
Code: Select all
Dim ok As Short Dim time_interval As Integer Dim time_units As Short Dim max_samples As Integer Dim time_ontest As Integer Dim timebase As Short = 12 Dim no_of_values As Short = 7000 Dim oversample As Short = 18 'Declare Function ps3000_set_channel Lib "ps3000.dll" (ByVal handle As Short, ByVal channel As Short, ByVal enabled As Short, ByVal dc As Short, ByVal range As Short) As Short If TestChannel = 0 Then ok = ps3000_set_channel(ps_handle, 1, 0, 1, VoltageRange) Else ok = ps3000_set_channel(ps_handle, 0, 0, 1, VoltageRange) End If Debug.WriteLine("set_channel: " & ok) 'Declare Function ps3000_get_timebase Lib "ps3000.dll" (ByVal handle As Short, ByVal timebase As Short, ByVal no_of_samples As Integer, ByRef time_interval As Integer, ByRef time_units As Short, ByVal oversample As Short, ByRef max_samples As Integer) As Short ok = ps3000_get_timebase(ps_handle, timebase, no_of_values, time_interval, time_units, oversample, max_samples) 'Declare Function ps3000_set_trigger Lib "ps3000.dll" (ByVal handle As Short, ByVal source As Short, ByVal threshold As Short, ByVal direction As Short, ByVal delay As Short, ByVal auto_trigger_ms As Short) As Short If ok > 0 Then ok = ps3000_set_trigger(ps_handle, TestChannel, test.TriggerLevel, 0, TestDelay, TimeOutms) 'Declare Function ps3000_run_block Lib "ps3000.dll" (ByVal handle As Short, ByVal no_of_values As Integer, ByVal timebase As Short, ByVal oversample As Short, ByRef time_indisposed_ms As Integer) As Short If chkintegerTest.Checked = True Then ok = ps3000_run_block(ps_handle, 7000, 13, 18, time_ontest) Else ok = ps3000_run_block(ps_handle, 7000, 12, 18, time_ontest) End If 'Declare Function ps3000_ready Lib "ps3000.dll" (ByVal handle As Short) As Short Dim ready As Short Do ready = ps3000_ready(ps_handle) If ready > 0 Then Exit Do End If Loop