PS2205 with Borland turbo C++

Post any questions you may have about our current range of oscilloscopes
Post Reply
xlbiker
Newbie
Posts: 0
Joined: Fri Aug 20, 2010 12:19 pm

PS2205 with Borland turbo C++

Post by xlbiker » Wed Aug 25, 2010 1:04 pm

Hello,
i try to write my own application using WinXP, Borland Turbo C++ 2006 and Picoscope2205.
After installing and testing “PicoScope 6” I started a new BCB Project, saved it an placed the PS2000 Files in the Project Folder: ps2000.c, resource.h and ps2000bc.lib these files I addet to the project too.
After that I searched for ps2000.rch and ps2000.h to put them into the compilation directory. But I can`t find the ps2000.rch so I took the ps2000.rc. Then I placed the ps2000.dll into the same folder as the executable.
Next I tried to compile and run the Project, it works.

But if I put an button to the form to call the function “ps200_open_unit()” like:

short ps2000_handle;
ps2000_handle = ps2000_open_unit();


I get an error:
AccessViolation at adress 10009062 in modul PS2000.DLL write adress 5201BA93 .

What is going wrong?

Thanks for your help!

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: PS2205 with Borland turbo C++

Post by Robin » Thu Aug 26, 2010 12:57 pm

Hi

I'm not sure what is causing the error message, but you'll notice that the description at the top of ps2000.c says that the example applies to the 210x oscilloscopes only.

It should be fairly easy to modify this to work with the 2205. However, the console example will work with the 2205 and demonstrates the necessary API calls.

Robin

xlbiker
Newbie
Posts: 0
Joined: Fri Aug 20, 2010 12:19 pm

Re: PS2205 with Borland turbo C++

Post by xlbiker » Tue Aug 31, 2010 8:40 am

Hi Robin,
thank you for your quick response, I tried to build the C- Project, unfortunately without success.
If I start the project I get following reply:

PS2000 driver example programm
Version 1.0

Opening the device...
Handler: 0
Unable to open device
Unit Not Opened
Error Code: £+@

or:

...
Error Code: D+@


Do you have an idea?

Thanks

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: PS2205 with Borland turbo C++

Post by Robin » Tue Aug 31, 2010 8:50 am

Hi

It sounds like the example has been built successfully but that it can't open the scope. Can you check that you can see it in Device Manager and that it's not being used by any other application (such as PicoScope 6)?

The error code appears to be displayed incorrectly. To check the status returned by the driver, it's best to step in to the code.

Robin

xlbiker
Newbie
Posts: 0
Joined: Fri Aug 20, 2010 12:19 pm

Re: PS2205 with Borland turbo C++

Post by xlbiker » Wed Sep 01, 2010 11:40 am

Hi Robin,
i agree with you, the example could get built! The Device is shown in DeviceManager (whitout any error or warning), and i close all applications i don`t need. But the first funktion-call "ps2000_open_unit" returns 0 --> "Handler: 0". I tried the XLS example and there is the return of this function 1.

I think one part of the driver and the Turbo Compiler don`t work together.

Do you have another idea?
Is it possible to get an complete c or c++ project for Borland?

Thanks

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: PS2205 with Borland turbo C++

Post by Robin » Thu Sep 02, 2010 8:51 am

Hi

A return value of 0 indicates that the unit can't be found and -1 indicates that it has failed to open.

I'm really not sure why you can't open the unit. You're using the correct .lib file (ps2000bc.lib). Data types should be the same. I wonder if it has something to do with name mangling. Are you building a C or C++ project?

It shouldn't be an issue as the header contains the following lines

Code: Select all

#ifdef __cplusplus
   #define PREF0 extern "C"



We don't have Borland here, but I'm not aware of anyone having problems with it.

All of our examples are included in the SDK.

Robin

xlbiker
Newbie
Posts: 0
Joined: Fri Aug 20, 2010 12:19 pm

Re: PS2205 with Borland turbo C++

Post by xlbiker » Wed Nov 17, 2010 10:03 am

Hi there,
now i have to pick up this project again, and i start with the old problems!
The PS2205 can`t be found.

I use the ps2000bc.lib, i place the file in the project folder like:
"C:\Projekte\NeueHardwareBeispiele\picoscopecon_c\ps2000bc.lib"
In these folder ther are also the other files:
ps2000con.c
ps2000.h

The ps2000.dll is here:
"C:\Projekte\NeueHardwareBeispiele\picoscopecon_c\Debug_Build\ps2000.dll"

I`m building a C project.

Can i be sure that the driver installation is correct? The PicoScope6 software and the Excel example is running.

Do i have to make changes in the ps2000.h file?

Thanks

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

Re: PS2205 with Borland turbo C++

Post by Chris » Wed Nov 17, 2010 4:01 pm

I presume you're building the example in the SDK?

(If not, start with that one)

You say the PS2205 can`t be found.

What message does the application display?


-Chris

xlbiker
Newbie
Posts: 0
Joined: Fri Aug 20, 2010 12:19 pm

Re: PS2205 with Borland turbo C++

Post by xlbiker » Thu Nov 18, 2010 9:19 am

Hi Chris,
yes, i took the example from the "PS2000sdk_r6_4_28.zip" file.
I took the "PS2000con.c" example, to create an c-console-application.
Now i can compile and start the project.
The console open and display following lines:


PS2000 driver example programm
Version 1.0

Opening the device...
Handler: 0
Unable to open device
Unit Not Opened
Error Code: £+@


...I think "Handler:" should return "1" not "0"....

-Roland

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

Re: PS2205 with Borland turbo C++

Post by Chris » Thu Nov 18, 2010 3:39 pm

Hi Roland

PS2000sdk_r6_4_28 didn't support the 2205.


It is supported in our latest SDK versions, which can be downloaded from the website


http://www.picotech.com/software.html


Select PicoScope 2205 in step 1 (select the product)

Select Software Development kit in step 2 (Software version)

xlbiker
Newbie
Posts: 0
Joined: Fri Aug 20, 2010 12:19 pm

Re: PS2205 with Borland turbo C++

Post by xlbiker » Fri Nov 19, 2010 7:51 am

Hi Chris,
now i work with the latest version...

But i have one Error while compile it:

Error: Ungelöste Externe '__kbhit' referenziert von c:\PICO2005_CON101119\DEBUG_BUILD\PS2000CON.OBJ
Can You help again?

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

Re: PS2205 with Borland turbo C++

Post by Chris » Fri Nov 19, 2010 9:01 am

Hi Roland

I'd take the PS2000sdk_r6_4_28 project that you had working that didn't find the PS2205, and replace the PS2000con.c file with the one downloaded from the latest SDK.


-Chris.

xlbiker
Newbie
Posts: 0
Joined: Fri Aug 20, 2010 12:19 pm

Re: PS2205 with Borland turbo C++

Post by xlbiker » Fri Nov 19, 2010 2:08 pm

Great, it works!

Next i try to change from the console project to GUI...

Nice weekend!

Post Reply