Test and Measurement Forum


Forum for discussing PicoScope version 6 (non-automotive version)


Postby PCBarnett » Thu Dec 20, 2007 2:27 pm

I have hit a VB exception disagreeing with how I have declared ps5000SetDataBuffer. There is some confusion in your different documents.

Manual states

PICO_STATUS ps5000SetDataBuffer
short handle,
PS5000_CHANNEL channel,
short * buffer,
long bufferLth

Delphi example has

function ps5000SetDataBuffers
( handle : smallInt;
channel : smallInt;
maxBuffer : pSmallInt;
minBuffer : pSmallInt;
bufferLength : Integer
) : smallInt
{$IFDEF WIN32} stdcall; external 'ps5000.dll'{$ENDIF}

c example has

ps5000SetDataBuffers(unit->handle, (PS5000_CHANNEL)i, buffers[i * 2], buffers[i * 2 + 1], sampleCount);

Can I have a library definition in VB express. Below is the definition that fails when called from the code. it looks similar to your examples. Tried one like the manual same effect. I am using 6.12

Declare Function ps5000SetDataBuffers Lib "C:\Program Files\Pico Technology\Pico Full\ps5000.dll" _
(ByVal handle As Short, _
ByVal channel As Short, _
ByRef buffer() As Short, _
ByRef buffermax() As Short, _
ByVal bufferLth As Integer)

Its now a month since i posted this is there no progress?
Active User
Active User
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am

Postby gruntman » Fri Jan 25, 2008 10:05 pm


You need to declare the function as follows:

Declare Function ps5000SetDataBuffer Lib "ps5000.dll" (ByVal handle As Integer, ByVal channel As Integer, buffer As Integer, ByVal length As Long) As Integer

You may want to look at the Visual Basic example that you can download from http://www.picotech.com/support/download.php?id=244. Most of your questions should be answered by going off of this example.


Richard Boyd
Technical Specialist
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Return to PicoScope 6 for Windows

Who is online

Users browsing this forum: No registered users and 0 guests