Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving very large amounts of data via ibrd in Visual Basic

I am trying to read anything from a single byte up to 2Mb of data back into a Visual Basic program. Until now I have been using something like

Dim Response as string * 60000
ibrda hDevice, Response

which works fine up to the magic 65536ish string size limit, but I want more!

Ideally reading into a very large byte array would suffice, e.g.

Dim ByteBuffer(0 To 2000000 - 1) As Byte
ibrd hDevice, ByteBuffer

But I cannot find a way to get the gpib-32.dll to accept the ByteBuffer as a destination in Visual Basic, even though ibrd32 is declared in vbib-32.bas as accepting Any type as a destination, and a Long as a count, implying the the 65536 limit doesn't apply for that call.

It may be possibl
e to use repeated ibrd calls until one such call fails to fill the buffer, concatenating the results each time, but this seems a crude solution when the DLL would appear to be able to do the job in one go.

Using ibrdf may work, but would rather not use a file as intermediate storage.

TIA
0 Kudos
Message 1 of 2
(3,306 Views)
I'm wondering if that # 65536 is a VB cap for string type. Refering to the lang intf,

Declare Function ibrd32 Lib "Gpib-32.dll" Alias "ibrd" (ByVal ud As Long, sstr As Any, ByVal cnt As Long) As Long
Sub ibrd(ByVal ud As Integer, buf As String) <---
Dim cnt As Long
cnt = CLng(Len(buf))
Call ibrd32(ud, ByVal buf, cnt)

isn't buf a string type?
0 Kudos
Message 2 of 2
(3,306 Views)