ps3000_get_timebase sometimes works wrong

Post general discussions on using our drivers to write your own software here
Post Reply
Guest

ps3000_get_timebase sometimes works wrong

Post by Guest »

ps3000_get_timebase function sometimes returns wrong time_units value.
It occures at high timebase values. The typical call

Code: Select all

ps3000_get_timebase(handle,
  9,          // timebase
  262144, // no_of_samples
  time_interval,
  time_units,
  1,         // oversample
  max_samples)
returns 3 for time_units (instead of 2). The error is not 100% reproducible, but rather frequent one. I'm using Picoscope 3224 and latest R5.xx software
---
Best regards,
Serg

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko »

Hi Serg,

The function will return 0 if it has failed and a non zero value if it has passed. So the number does not matter as long as its not a zero when it passes.

Hope this helps.
Ziko

Technical Specialist

Guest

Post by Guest »

ziko wrote:Hi Serg,

The function will return 0 if it has failed and a non zero value if it has passed. So the number does not matter as long as its not a zero when it passes.

Hope this helps.
The bug report was about time_units out value, not about the function result. I just want to know will you fix it or I must write my own workaround - no problem really.
---
Best regards,
Serg

Guest

Post by Guest »

May be I'm not quite clear in starting post.

the function call:

Code: Select all

ps3000_get_timebase(handle,
  9,          // timebase
  262144, // no_of_samples
  time_interval,
  time_units,
  1,         // oversample
  max_samples)
the function returns a non zero value (OK)
the correct out value for time_units is 2
the actual out value for time_units is 3

device: Picoscope 3224

---
Best regards,
Serg

markB
Site Admin
Site Admin
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Post by markB »

Here are the argument descriptions from the PS3000 manual:
time_interval, a pointer to the time interval, in nanoseconds, between readings at the selected timebase. If a null pointer is passed, nothing will be written here.

time_units, a pointer to the most suitable units that the results should be measured in. This value should also be passed when calling ps3000_get_times_and_values(). If a null pointer is passed, nothing will be written here.
I think the confusion has arisen because the time_interval is always measured in ns. The time_units are the highest precision units that the times can be returned in (from ps3000_get_times_and_values()) without overflowing a ULONG.

Eg: given your parameters, time_interval is 25,600ns. Multiplying this by 262,144 samples gives a collection time of 6,710,886,400ns. The maximum collection time in ns that you can express in a ULONG is 4,294,967,296ns. The function therefore returns us as the most suitable time unit.
Regards

Mark

Guest

Post by Guest »

Oh, thanks! You hit the point.

Sometimes short formal descriptions in manual are not enough.

---
Best regards,
Serg

Post Reply