Test and Measurement Forum

Problem with the number of samples retrieved

Post your C and C++ discussions here

Problem with the number of samples retrieved

Postby jbl » Thu Jan 26, 2017 3:09 pm

Hi,

I am still writing a C-code to communicate with my 5244B Picoscope.
After some troubles with the ps5000aOpenUnit everything seems to be ok.
Thanks to Hitesh for his help on this first problem.

The C-code is written with the graphical library gtk+. The program is very simple.
It displays a window in which the signal on channel A is given. Some buttons and combo boxes allow timebase, sensitivity and trigger tunings.

The whole code is given in attachement.

My question is about the number of samples in the CallBack function "Oscilloscope".
I don't understand why the the number of samples that is required with the function ps5000aGetValues (4096) is not the actual number retrieved (1024). This actual number is always 1024 whatever the timebase parameter in ps5000aRunBlock function.

I think I haven't understood something, but what ?

Thank you for your help.

Regards
Attachments
PicoV1.c
(8.57 KiB) Downloaded 11 times
jbl
Active User
Active User
 
Posts: 8
Joined: Fri Dec 16, 2016 2:35 pm

Re: Problem with the number of samples retrieved

Postby jbl » Fri Jan 27, 2017 8:36 am

Hi,
Sorry for this silly question (in very poor english).
I haven't seen that parameters 2 and 3 of ps5000aRunBlock function give the number
of required samples.
Here is a better code.
Regards
Attachments
PicoV1.c
(8.53 KiB) Downloaded 14 times
jbl
Active User
Active User
 
Posts: 8
Joined: Fri Dec 16, 2016 2:35 pm

Re: Problem with the number of samples retrieved

Postby Martyn » Fri Jan 27, 2017 10:35 am

Looking at the code the first example had 512 pre trigger and 512 post trigger samples. The second example looks correct, so I am guessing that the code is doing what you expect :)
Martyn
Technical Support Manager
Martyn
Site Admin
Site Admin
 
Posts: 2617
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problem with the number of samples retrieved

Postby jbl » Fri Jan 27, 2017 12:16 pm

Yes, it's working fine now.
4096 samples retrieved with no lost.
Here is the last version with a spin button for threshold tuning.

PicoV1.jpeg


The gtk widget "curve" is used to display the signal.
This widget is deprecated by gtk developers.
Does somebody know or use a gtk graphical tool that could replace it ?
Attachments
PicoV1.c
(8.65 KiB) Downloaded 11 times
jbl
Active User
Active User
 
Posts: 8
Joined: Fri Dec 16, 2016 2:35 pm


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests