Test and Measurement Forum

PS2000 Excel Sample Crashes At ps2000_get_times_and_values()

Post your VB and VBA discussions here

PS2000 Excel Sample Crashes At ps2000_get_times_and_values()

Postby Rogue95 » Wed Apr 20, 2016 8:15 pm

To Whom Can Answer,

Hello. I have a Picoscope connected via USB to a Windows Vista 32-bit computer. I am trying to run the sample Excel macro program that came with my Picoscope 6 software CD. When I run the macro, it starts executing correctly. I see that it populates the fields for the Driver, USB, Hardware, Device, Serial, and Cal Date. However, when the code comes to the line "ps2000_get_times_and_values(...)", the macro crashes and fails. Please help! I don't know what to do to get the line to run properly. I see 4 channel arrays were being passed into "ps2000_get_times_and_values(...)" and so I changed it to pass just one channel array (Channel A array), but that still didn't make any difference. Please advise. :(


Thanks,

Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby AndrewA » Fri Apr 22, 2016 9:45 am

Hi Rogue,

I not sure which version of the CD you have.
I would remove any Pico driver files you have manually copied to ie (C:\Windows\system\)
And download the latest Software Development Kit from our website at:
https://www.picotech.com/download/
In the right hand column click on PicoSDK 32 bit to download. Choose the stable version

The SDK installer will automatically install all the drivers into the system PATH.
The Excel example may have been updated from your CD version.

You can read this forum post for more information about SDK packages-https://www.picotech.com/support/topic18991.html

Post back if you are still having issues.
Regards Andrew
Technical Specialist
AndrewA
Zen Master
Zen Master
 
Posts: 178
Joined: Tue Oct 21, 2014 3:07 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Rogue95 » Fri Apr 22, 2016 6:36 pm

Hi Andrew,

Thanks for the advice. I will download the latest SDK from the website and give it a try
and let you know.

Just to let you know, my CD is PicoScope version R6.10.818.
The 32-bit SDK file in the CD is called "PicoSDK_32_10.6.10.24.exe".

Regards,

Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Rogue95 » Fri Apr 22, 2016 9:47 pm

Hi Andrew,

I think my CD version is newer than the one on the website. Anyhow,
I gave it a try with the one from the website and the same error happens
in Excel still.

I did as you said. I had removed the .dll files from C:\Windows\System32 since the software already places them in a directory that is specified in the PATH variable and then I ran the
Excel macro in the debugger. As I stepped through line by line, the code ran, but once
I stepped through the line "ps2000_get_times_and_values(...)", the spreadsheet crashed
and closed itself. Please advise

- Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Rogue95 » Fri Apr 22, 2016 10:56 pm

Hi Andrew,

I think the SDK on my CD is a newer version than
what's on the website. Anyhow, I went ahead
and downloaded the latest stable version and installed
it. I had removed the .dll files from C:\Windows\System32
prior to installation as you requested.

I ran the Excel macro and still got the same result.
The code runs until the line "ps2000_get_times_and_values(...)"
where it crashes and the spreadsheet terminates. Please advise
as to the next step.

Thanks,

Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Rogue95 » Sat Apr 23, 2016 12:36 am

Andrew,

Nevermind. I found the problem. I was opening up the spreadsheet in LibreOffice and running the macros. I had assumed that they would work the same as Excel, but I found that this is not the case. When I ran macro in a borrowed a copy of Excel, it worked flawlessly. So there is some problem in LibreOffice and I have to see if there is any workaround or stick with Excel.

Appreciate your time and help nonetheless.

Regards,

Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Rogue95 » Tue May 31, 2016 10:32 pm

Hi Andrew,

Do know if there is a workaround if we run the Excel file in LibreOffice?
Again the Excel file I'm talking about is "PS2000.xls" and it errors/crashes at the
"ps2000_get_times_and_values(...)" call whenever we run it in LibreOffice.

The reason I am asking this because we would have buy to licenses
for using Excel, but LibreOffice is free software and requires no additional costs.

Thanks,

Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Hitesh » Wed Jun 01, 2016 2:54 pm

Hi Rogue95,

Please check that the size of the arrays being passed to the function call are large enough for the number of samples that you are requesting.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2008
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Rogue95 » Thu Jun 02, 2016 8:40 pm

Hi Hitesh,

Thanks for your help. Remember, the Excel file is a sample I retrieved
from the PicoSDK. I haven't changed anything in the file which I'm trying
to run in LibreOffice.

Just for grins, I went ahead and made the arrays really large to see if
that would help any, but as expected, the macro still crashed at the line with
"ps2000_get_times_and_values(...)" after I clicked the "Get Block" button.

Just to let you know, I had ran the Excel file using Excel itself on another PC
and found that the macro worked perfectly, but the goal is to make
it run in LibreOffice so that we can avoid buying several licenses for Excel.
You see, our plan is to run this program on several PCs. Please advise next step.

Thanks,

Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Hitesh » Fri Jun 03, 2016 2:09 pm

Hi Rogue95.

I have been able to reproduce the problem and as a workaround used the ps2000.dll from the PicoScope 6.11 (as well as PicoScope 6.12 Beta) installation directory.

This resolves the crash but unfortunately I do not get any values back so it seems there is a difference in the way LibreOffice basic handles memory being used with driver API functions.

I will investigate further and get back to you.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2008
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Rogue95 » Fri Jun 10, 2016 11:28 pm

Hi Hitesh,

Did you get a chance yet to see if you could get LibreOffice
to output correct values?

Thanks,

Rogue95
Rogue95
Newbie
 
Posts: 0
Joined: Wed Apr 20, 2016 7:56 pm

Re: PS2000 Excel Sample Crashes At ps2000_get_times_and_valu

Postby Hitesh » Mon Jun 13, 2016 12:37 pm

Hi Rogue95,

Apologies, I have not been able to investigate this further.

From what I observed before my last post, this is something to do with how LibreOffice handles VBA macros and this is likely to require further research into the interaction of LibreOffice with macros and calling API functions from dll files.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2008
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests