Test and Measurement Forum

PicoScope 2203 VB sample program crashes VB6

Post your VB and VBA discussions here

PicoScope 2203 VB sample program crashes VB6

Postby bob.freeth » Thu May 08, 2008 8:59 am

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
Active User
Active User
 
Posts: 5
Joined: Sat May 03, 2008 5:29 pm
Location: New Milton

Postby bob.freeth » Thu May 08, 2008 9:27 am

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
bob.freeth
Active User
Active User
 
Posts: 5
Joined: Sat May 03, 2008 5:29 pm
Location: New Milton

Postby markspencer » Tue May 13, 2008 1:19 pm

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
User avatar
markspencer
Site Admin
Site Admin
 
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Problem resolved - thank you

Postby bob.freeth » Tue May 13, 2008 2:12 pm

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
bob.freeth
Active User
Active User
 
Posts: 5
Joined: Sat May 03, 2008 5:29 pm
Location: New Milton

Re: PicoScope 2203 VB sample program crashes VB6

Postby colindavidfoster » Fri Feb 18, 2011 1:57 pm

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?
colindavidfoster
 

Re: PicoScope 2203 VB sample program crashes VB6

Postby Chris » Wed Feb 23, 2011 3:51 pm

Updated in SDK post R10.1.0.8
Chris
Site Admin
Site Admin
 
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests