PicoScope 2203 VB sample program crashes VB6

 
Post new topic   Reply to topic    Pico Technology Forum Index -> VB and VBA (Excel, Access)
Author Message
bob.freeth
Active User
Active User


Joined: 03 May 2008
Posts: 5
Location: New Milton

PostPosted: Thu May 08, 2008 8:59 am    Post subject: PicoScope 2203 VB sample program crashes VB6 Reply with quote

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.
Back to top
bob.freeth
Active User
Active User


Joined: 03 May 2008
Posts: 5
Location: New Milton

PostPosted: Thu May 08, 2008 9:27 am    Post subject: Reply with quote

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
Back to top
markspencer
Site Admin
Site Admin


Joined: 07 May 2003
Posts: 610

PostPosted: Tue May 13, 2008 1:19 pm    Post subject: Reply with quote

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:

'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)
Back to top
bob.freeth
Active User
Active User


Joined: 03 May 2008
Posts: 5
Location: New Milton

PostPosted: Tue May 13, 2008 2:12 pm    Post subject: Problem resolved - thank you Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> VB and VBA (Excel, Access)
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group