Test and Measurement Forum

Unbalanced stack error with PS3000 function

Post your VB and VBA discussions here

Unbalanced stack error with PS3000 function

Postby AnthonyCSheehy » Fri May 04, 2007 10:30 am

I am programming in VB.net using VS2005 pro. I have a Picoscope 3224.

I have my declare function as follows:
Declare Function ps3000_run_streaming_ns Lib "ps3000.dll" (ByVal handle As Short, ByVal sample_interval As Long, ByVal time_units As Short, ByVal max_samples As Long, ByVal auto_stop As Short, ByVal noOfSamplesPerAggregate As Long, ByVal overview_buffer_size As Long) As Short

However, I get a stack imbalance whenever I call the function, with the suggestion that what I am passing to the unmanaged code is not what the unmanaged code is expecting. it maybe a coincidence, but only functions with the time_units parameter throw this error. The documentation only specifies a type of PS3000_TIME_UNIT?

short ps3000_run_streaming_ns (
short handle,
unsigned long sample_interval,
PS3000_TIME_UNITS time_units,
unsigned long max_samples,
short auto_stop,
unsigned long noOfSamplesPerAggregate,
unsigned long overview_buffer_size )

I have tried a short type but this also fails. Any help?
Anthony Sheehy
MCP
AnthonyCSheehy
Active User
Active User
 
Posts: 7
Joined: Fri May 04, 2007 10:18 am

Postby AnthonyCSheehy » Fri May 04, 2007 11:45 am

actually, I have discovered the problem. The unsigned long need to be reference with a uinteger type in VB, and the time_unit is a short.

Now onto the ps3000_get_streaming_last_value() which does not have a define function in the examples... so if you have one for me, that would save me time.
Anthony Sheehy
MCP
AnthonyCSheehy
Active User
Active User
 
Posts: 7
Joined: Fri May 04, 2007 10:18 am

Postby ziko » Tue May 22, 2007 9:32 am

HI and thank you for your post.

Please refer to PS3000044.pdf manual located in your installed folder, this has the necessary information (page 33).


Kind regards

Ziko
Ziko

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests