How to control Pic4262 by Borland C++

Post your C and C++ discussions here
Post Reply
xaviery
Newbie
Posts: 0
Joined: Thu Oct 25, 2018 2:11 am

How to control Pic4262 by Borland C++

Post by xaviery » Thu Oct 25, 2018 8:03 am

Dar all.
I use pico USB 4262, I would like to integrate this carde in an existing application programmed in Borland c++. What I want is to record a waveform by software.
Is there any example in C++ Borland?
Thank you in advance
Xavier

Hitesh
Advanced User
Advanced User
Posts: 2856
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: How to control Pic4262 by Borland C++

Post by Hitesh » Mon Oct 29, 2018 7:11 pm

Hello Xavier,

You can obtain a C example for the ps4000 driver API functions from https://github.com/picotech/picosdk-c-examples

You will need to generate your own Borland lib files. The C header files are available via the installation directory of the PicoSDK.

Regards,
Hitesh

Software Dev. Engineer

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Re: How to control Pic4262 by Borland C++

Post by XavierPico » Thu Jan 23, 2020 6:06 pm

Many thanks Hitesh,
I will explore the link and seek further to generate Borland *.lib.
With my best regards
Xavier

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Re: How to control Pic4262 by Borland C++

Post by XavierPico » Sat Jan 25, 2020 10:03 am

Dear all.
Thanks to Hitesh, I have regenerated *.lib in order to use ps4000.dll in C++ Builder.
What I want to do is to control picoscop4262 for data recording. In sample site https://github.com/picotech/picosdk-c-examples, I don't find C++ Builder application cases (Borland, now Embarcadero).
Would you please help me to start with a simple example in C++ Builder (sorry, I am electro technic engineer, I don't know very much the differences of C++ languages). Is there any example in C++ Borland?
Thank you in advance
Xavier

Martyn
Site Admin
Site Admin
Posts: 3802
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: How to control Pic4262 by Borland C++

Post by Martyn » Sun Jan 26, 2020 9:22 am

We don't have specific projects for Borland, so create a new project and just add the relevant files.
Martyn
Technical Support Manager

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Re: How to control Pic4262 by Borland C++

Post by XavierPico » Sun Jan 26, 2020 3:55 pm

I have regenerated *.lib in order to use ps4000.dll in C++ Builder 2010.
In a new C++Builder project, I have included:
ps4000.lib
#include "ps4000Api.h"
#include "PicoStatus.h"
#include "PicoConnectProbes.h"
After compilation, the project is OK with executable. Then, according to PicoScope 4000 Series Programmer's Guide, I have simply added two lines:

int16_t handle;
ps4000SetNoOfCaptures(handle, 100);

Here is the error message:
[BCC32 Error] WaveDataPico4262.cpp(82): E2268 Call to undefined function 'ps4000SetNoOfCaptures'

Many thanks for your help.
Xavier

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Re: How to control Pic4262 by Borland C++

Post by XavierPico » Fri Mar 27, 2020 10:29 am

Dear All,
I have confused 32bit DLL and 64bit DLL. Now the compilation is OK.
But I have a key question: how to use pic4262; i.e. how to use the functions in https://github.com/picotech/picosdk-c-examples under Borland C++.

Many thanks for your help.
Xavier

Martyn
Site Admin
Site Admin
Posts: 3802
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: How to control Pic4262 by Borland C++

Post by Martyn » Sun Mar 29, 2020 7:46 am

Does the example code now run?
Martyn
Technical Support Manager

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Re: How to control Pic4262 by Borland C++

Post by XavierPico » Sun Mar 29, 2020 8:49 am

Not yet, one of the reasons may be: lack of some files such as #include , #include , #include .
Thanks
Xavier

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

OK: How to control Pic4262 by Borland C++

Post by XavierPico » Wed Apr 08, 2020 12:44 pm

Dear all,
Based on "ps4000Con" examples, I have successfully piloted picoscope 4262 under Borland C++Builder with the function void BlockDataHandler(UNIT_MODEL * unit, char * text, int32_t offset). Just one function, but it’s a lot for me. I‘d like to share this achievement with you. Here are the key things to do in order to use the example written in VC++:
• Download “ps4000.dll”
• Create “ps4000.lib” under Borland C++Builder
• Create your own _kbhit(), or just delete _kbhit() (what I have done)
• Replace printf(….) by Memo1->Lines->Add() as my C++ Builder is not in Console mode;
Many thanks for your helps to reach this first stage.
Xavier

Post Reply