PicoScope 2203 VB sample program crashes VB6

Post your VB and VBA discussions here
Post Reply
bob.freeth
User
User
Posts: 5
Joined: Sat May 03, 2008 5:29 pm
Location: New Milton

PicoScope 2203 VB sample program crashes VB6

Post by bob.freeth »

When running the VB sample program with a PicoScope 2203 using VB6 running under Vista Business 32 bit:

1. after clicking Open I receive the message PS2000 opened
2. after clicking theFast button the VB6 environment greys out and I receive a Windows dialog showing:

Visual Basic has stopped working

A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

The statement that causes the crash is in the procedure Fast_Click:

ok = ps2000_get_values(ps2000_handle, Values_a(0), 0, 0, 0, overflow, 100)


Suggestions anyone?

Is it known that the sample program works with Vista?

Thanks.

bob.freeth
User
User
Posts: 5
Joined: Sat May 03, 2008 5:29 pm
Location: New Milton

Post by bob.freeth »

I have also tried the sample program on XP Pro SP3 and the VB6 environment also crashes when the Fast button is clicked.

When a compiled version is run it just closes after the Fast button is clicked.

Has anyone got this sample to run with a 2203?

Thanks

User avatar
markspencer
Site Admin
Site Admin
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Post by markspencer »

Hi,

I am sorry that you have experienced problems with the ps2000 vb example. I have looked in to this and found that the funcion call has to have a buffer for each paramater:

Code: Select all

'The following should be placed under the 
ReDim Values_a(200000) As Integer
'which is part of the Fast_Click procedure
 
ReDim Values_b(200000) As Integer
ReDim Values_c(200000) As Integer
ReDim Values_d(200000) As Integer


ok = ps2000_get_values(ps2000_handle, Values_a(0), Values_b(0), Values_c(0), Values_d(0), overflow, 100) 
Regards,

Mark Spencer

bob.freeth
User
User
Posts: 5
Joined: Sat May 03, 2008 5:29 pm
Location: New Milton

Problem resolved - thank you

Post by bob.freeth »

Thank you for the resolution to the problem.

There is a similar coding error in the procedure Timer1_Timer() and by applying the same technique it can also be made to work.

The original statement of

no_of_values = ps2000_get_values(ps2000_handle, Values_a(0), 0, 0, 0, overflow, no_of_values)

when changed to

no_of_values = ps2000_get_values(ps2000_handle, Values_a(0), Values_b(0), Values_c(0), Values_d(0), overflow, 100)

and the following additional re-dims

ReDim Values_b(1024) As Integer
ReDim Values_c(1024) As Integer
ReDim Values_d(1024) As Integer

placed after

ReDim Values_a(1024) As Integer

enables the program to run fine.

Many thanks for your help

colindavidfoster

Re: PicoScope 2203 VB sample program crashes VB6

Post by colindavidfoster »

These errors still seem to be in Timer1_Tick() in ps2000_frm.vb in the latest SDK download. Time for someone to upload some corrections, perhaps?

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: PicoScope 2203 VB sample program crashes VB6

Post by Chris »

Updated in SDK post R10.1.0.8

Post Reply