Test and Measurement Forum

acquire rapid block

Post your .Net discussions here

acquire rapid block

Postby Mikkel » Wed Dec 16, 2015 3:04 pm

I'm trying to use the a rapid block acquisition with a vb code (see later) to catch a series of traces (stored in the array of arrays called "values" - I got this part of the code from the c# example in the SDK). The problem is that all the traces are identical, which I'm sure they shouldn't be. Can you please help me on this issue.

vb code:

Public Sub AquireRapidBlock()
Dim nCaptures As Integer = numScansRequired
Dim nSegments As Integer = numScansRequired
Dim nMaxSamples As Integer
Dim timeIndisposed As Int32


status = MemorySegments(picoHandle, nSegments, nMaxSamples)

status = SetNoOfRapidCaptures(picoHandle, nCaptures)

Dim ps5000aBlockCallback As ps5000aBlockReady = New ps5000aBlockReady(AddressOf BlockCallback)
Dim t0 As Date = Now
deviceReady = False
status = RunBlock(picoHandle, 0, numPoints, timebase, timeIndisposed, 0, ps5000aBlockCallback, vbNull)

Do Until deviceReady
Application.DoEvents()
Loop


Dim numCompletedCaptures As Integer
status = GetNoCaptures(picoHandle, numCompletedCaptures)
status = StopPico(picoHandle)
Dim values()()() = New Short(numCompletedCaptures - 1)()() {}
Dim pinned As PinnedArray(Of Short)(,) = New PinnedArray(Of Short)(numCompletedCaptures - 1, 1) {}
For i As Integer = 0 To numCompletedCaptures - 1
values(i) = New Short(1)() {}
For Channel As Integer = 0 To 1
values(i)(Channel) = New Short(numPoints) {}
pinned(i, Channel) = New PinnedArray(Of Short)(values(i).Count)
For j As Integer = 0 To numCompletedCaptures - 1
status = SetDataBuffer(picoHandle, 0, values(i)(0), numPoints, i, RatioMode.None)

Next

Next

Next
ScanList.Clear()
Dim overflow() As Short
status = GetValuesRapid(picoHandle, numPoints, 0, nSegments - 1, 0, DownSamplingMode.None, overflow)
For i As Integer = 0 To numCompletedCaptures - 1

Dim scanLine(numPoints) As Double

Dim buf1() As Short = values(numCompletedCaptures - 1)(0)
For j As Integer = 0 To numPoints - 1

scanLine(j) = adcToMv(buf1(j), Range.Range_2V)

Next


ScanList.Add(scanLine)

Next
For Each p As PinnedArray(Of Short) In pinned
If p IsNot Nothing Then
p.Dispose()
End If
Next


overflow = Nothing
GetMinMaxScanValues()


End Sub

regards

Mikkel
Mikkel
Newbie
 
Posts: 0
Joined: Sat Sep 12, 2015 1:39 pm

Re: acquire rapid block

Postby Mikkel » Fri Dec 18, 2015 7:55 am

Sorry, my bad. The line:
Dim buf1() As Short = values(numCompletedCaptures - 1)(0)

should instead be:
Dim buf1() As Short = values(i)(0)
Mikkel
Newbie
 
Posts: 0
Joined: Sat Sep 12, 2015 1:39 pm


Return to .Net Languages (C#, VB.Net, .)

Who is online

Users browsing this forum: No registered users and 0 guests