Forum for discussing PicoScope version 6 (non-automotive version)
Post Reply
Posts: 9
Joined: Tue Feb 27, 2007 11:46 am


Post by 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?

Advanced User
Advanced User
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Post by 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 Most of your questions should be answered by going off of this example.


Richard Boyd
Technical Specialist

Post Reply