How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post your C and C++ discussions here
Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post by Martyn »

With the channel DC coupled, nothing connected and the range set on 50V what readings do you get ?

Then repeat with range set on 100mV.
Martyn
Technical Support Manager

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

Re: How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post by XavierPico »

Here are the test results:
Case 1: ChannelA: 50V, ChannelB:0.1V, are DCCoupled, nothing connected.
Timebase, SampleInterval: 199 , 2.5E-6
Returned timeIndisposed = 252
First N-points readings, Channel readings are in ADC Counts and mV
Channel A Channel B
-32767 -49954 32767 99
-32767 -49954 32767 99
-32767 -49954 32767 99
-32767 -49954 32767 99
-32767 -49954 32767 99
-32767 -49954 32767 99
-32767 -49954 32767 99

Case2: as Case1, just change ChannelA to 0.1V:
Channel A Channel B
-32767 -99 32767 99
-32767 -99 32767 99
-32767 -99 32767 99
-32767 -99 32767 99
-32767 -99 32767 99
-32767 -99 32767 99
-32767 -99 32767 99
-32767 -99 32767 99

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

Re: How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post by Martyn »

These are the values I get from a device when running the GitHub code with the 100mV range and nothing connected

Code: Select all

Time   Ch   Max ADC   Max mV   Min ADC   Min mV   
0 ChA  135 = 0mV, 135 = 0mV   
5 ChA  72 = 0mV, 72 = 0mV   
10 ChA  51 = 0mV, 51 = 0mV   
15 ChA  72 = 0mV, 72 = 0mV   
20 ChA  72 = 0mV, 72 = 0mV   
25 ChA  72 = 0mV, 72 = 0mV   
30 ChA  51 = 0mV, 51 = 0mV   
35 ChA  30 = 0mV, 30 = 0mV   
40 ChA  72 = 0mV, 72 = 0mV   
45 ChA  51 = 0mV, 51 = 0mV   
50 ChA  114 = 0mV, 114 = 0mV   
55 ChA  72 = 0mV, 72 = 0mV   
60 ChA  51 = 0mV, 51 = 0mV   
65 ChA  93 = 0mV, 93 = 0mV   
70 ChA  197 = 0mV, 197 = 0mV   
75 ChA  197 = 0mV, 197 = 0mV  
So I would suspect that the data is not being read correctly from the device.

I would suggest stepping through the code, making sure that all status code returns are Pico_OK (0), to see if you can find where it is failing.

Another option is to put in a DC voltage at a known level, and set the range so that it is twice this value 1V signal 2V range. You should then get ADC counts in the range of 15000
Martyn
Technical Support Manager

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

Re: How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post by XavierPico »

I have tested with a DC signal generator, Scale of ChannelA: 10V with DC coupled.
Here are the results:
Voltage generated Measured in Int
0V -32767
1.6V -32767
2.5V -29817
5.0V -21604
7.5V -13523
9.9V -5423
-1V 32767
-5V 21746
There is a dead band from 0 to 1.6V with wrong values. For the rest int values, they are not correct but there are some tendances with offset.
I have checked all returned status, they are all 0.
Therefore, the all functions of the card4824 are currently integrated in another existing application. I'll try to merge all functions in one file and ask you later for an overall checking.
Thanks in advance
Xavier

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

Re: How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post by Martyn »

It's almost as if there is an Analog Offset applied in the SetChannel call, or there is an issue between signed and unsigned ints
Martyn
Technical Support Manager

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

Re: How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post by XavierPico »

Dear Martyn,
Many thanks for your continuing help.
When I check all my program libraries this afternoon, I realized that ps4000a.dll I used is dated in April 2019.
I have then updated the last one in SDK dated September 2021 (I have regenerated ps4000a.lib for my C++Builder).
Very good surprise, my card4824 works (I have only tested BlockDataHandler(), presently it is enough for my application). The values measured are almost the same as you mentioned in our last exchange messages.
Maybe there are some issues between signed and unsigned ints in different versions. Anyway, with the last SDK, 4824 has a good performance in our application under Embarcadero C++ Builder.
Have nice day
Xavier

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

Re: How to control Picoscope card 4824a by Embarcadero C++ Builder?

Post by XavierPico »

Dear technical support team,
My ps4824a is now operational with BlockDataHandler (with or without trigger).
May I continue this discussion for the function
ps4000aRunStreaming(unit->handle, &sampleInterval, timeUnits, preTrigger, postTrigger, autostop, downsampleRatio, ratioMode, bufferLength)
that I try to use now.
It works, my question concerns my understandings of this function.
If I want to define sampling period (this function doesn't use "timebase"), I have to select good values of "sampleInterval" and "timeUnits".
"timeUnits" gives ns, µs, ms, etc.
"sampleInterval" gives integer number of "timeUnits".
So sampling period = "sampleInterval" * "timeUnits", i.e. integer number of ns, µs, ms etc. I can't use 2.5µs as sampling period.
Am I right or is there any other method to set sampling period?
Many thanks in advance for your help.
Xavier

Post Reply