Test and Measurement Forum

Valid documentation for PicoScope 2000?

Post your C and C++ discussions here

Valid documentation for PicoScope 2000?

Postby Ilya » Tue Jun 04, 2013 12:06 pm

I started programming PicoScope 2204 and went carefully through the documentation. My impression is that it is inaccurate and incomplete in nearly every aspect, even though I am reading the latest version. Is someone at Pico Technology responsible for updating that?

Here are just a few difficulties I stumbled into during the first two days of programming.

1. Calling ps2000_set_channel() function (and perhaps any other) right after ps2000_open_unit() will return an error. One must introduce a small delay (e.g., using Sleep(1)) before calling other functions. Same bug is present if the unit is opened using ps2000_open_unit_async() + ps2000_open_unit_progress().

2. Setting timebase above 23 (~80ms/div) returns an error, whereas specification claims it can be up to 1000s/div.

3. There is no formula for conversion of raw data from drivers to voltage. Even worse, different source files (I used sources for C and Delphi) use different conversion formula. So what is the correct expression for that?

4. In block (and perhaps ETS, but I have not checked that) mode, function ps2000_get_times_and_values() returns an error if called before ps2000_stop(), whereas documentation (page 7) says it must be called in this order.

5. Does the overflow value returned by ps2000_get_times_and_values() represent voltage overflow or buffer overflow?

6. What are the units of time_interval returned by get_timebase()? Seems to be always ns? If it is not the same as time_units, then what is the purpose of that and how to use them?

P.S. A good product can be killed by buggy documentation. Sad to say, but until now PicoScope 2000 series makes an impression of low-quality product :(
Ilya
Newbie
 
Posts: 0
Joined: Thu May 30, 2013 5:12 pm

Re: Valid documentation for PicoScope 2000?

Postby Martyn » Tue Jun 04, 2013 1:05 pm

I will feedback your general concerns about the documentation to our team, but will answer your questions :-

1. Possibly, particularly as PC's get faster. Our example code generally reports back that the unit has been opened so has a natural delay.

2. The max timebase setting for the 220x series is 23 as detailed in the header files. The 1000s/div is referencing using the scope with Picoscope software and the scope will be running in streaming mode for these settings. For the latest version of the software this is 5000s/div.

3. (raw value / max_adc_count) * range is used by the examples where max_adc_count is 32767. You should find this in all of them.

4. Our examples call stop before getting the values, the documentation is incorrect.

5. Overflow is a bit pattern with one bit per channel indicating if a channel has a voltage overflow. As detailed on Page 5 a data value of PS2000_LOST_DATA indicates a buffer overrun.

6. We would need to see how you are calling this function and the parameters you are passing to verify this.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2348
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Valid documentation for PicoScope 2000?

Postby Ilya » Tue Jun 04, 2013 2:04 pm

Thank you very much for the quick reply! I hope the feedback about documentation will be heard and it will be improved.

1. There should be a way to tell whether the device is ready to collect data or not. Otherwise, how can I be sure that the program written on one PC will work on another (which is possibly faster)? I would expect that ps2000_open_unit() returns only when all the routine is done and the driver is ready to accept other commands.

2. Well, I am actually using Delphi and the example for Block mode does not work at all, not saying that the constants are not defined there. I looked through the C code and figured out how to fix the non-working block-mode code, but overlooked the max timebase.

3. Line 123 in "C gui" example shows another formula. Even though the difference in denominator might be negligible, it makes the reader of the code doubt in the validity of formulas, since one contradicts to another.

4,5. I suspected this. Thanks for confirmation.

6. I do not do anything extraordinary. For example, it can be like that:
Code: Select all
PSHandle = ps2000_open_unit();
timebase = 0;
NoS = 4;
oversample = PS2000_MAX_OVERSAMPLE;
ps2000_get_timebase(PSHandle, timebase, NoS, tInterval, tUnits, oversample, maxSamples);

tInterval, tUnits, and maxSamples are not NULL. Does the answer depend on the value of timebase/NoS/oversample?
Ilya
Newbie
 
Posts: 0
Joined: Thu May 30, 2013 5:12 pm

Re: Valid documentation for PicoScope 2000?

Postby Martyn » Mon Jun 17, 2013 9:09 am

I know that point 6 has been addressed in the documentation for publishing soon
Code: Select all
time_interval: on exit, this location will contain the time
interval, in nanoseconds, between readings at the selected
timebase.

I wasn't aware of the subtle difference with the GUI code, not an example I have looked at, but understand where you are coming from so will feedback this info.

I will carry out some further testing on point 1 and report back later.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2348
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Valid documentation for PicoScope 2000?

Postby Ilya » Sat Jun 22, 2013 2:01 pm

Thank you, Martyn, for your reply. I'll look forward to seeing any solution to point 1.
Ilya
Newbie
 
Posts: 0
Joined: Thu May 30, 2013 5:12 pm

Re: Valid documentation for PicoScope 2000?

Postby Ilya » Fri Jun 28, 2013 10:45 pm

I have to apologize for claiming a bug in ps2000_open_unit(). The function seems to work correctly (returning control when oscilloscope is ready), and point 1 can be considered as solved.

This was a difficult to debug trouble related to the way Delphi stores enumerated types in memory. By default, it occupies one byte, whereas C/C++ uses a word (two bytes). So the following code most often will fail:

Code: Select all
var
  Range: PS2000_RANGE; //<-- Enumerated type (one byte)
begin
  PSHandle := ps2000_open_unit;
  Range := PS2000_2V;
  ps2000_set_channel(PSHandle, PS2000_CHANNEL_A, true, true, Range);
end;

The reason it fails is that local variable Range is stored in AL register (one byte), whereas ps2000_set_channel() takes a word, i.e. AX=(AH, AL), and AH contains some random value - so the range will be a too large number. Inserting Sleep(1) right after ps2000_open_unit() zeros the whole EAX register and hence ps2000_set_channel() receives a correct value (with AH=0).

In Delphi, for enumerated types to occupy two bytes in memory they should be declared with {$Z2} compiler option. This solves my problem. Hope this will be helpful for other Delphi programmers.
Ilya
Newbie
 
Posts: 0
Joined: Thu May 30, 2013 5:12 pm

Re: Valid documentation for PicoScope 2000?

Postby Martyn » Mon Jul 01, 2013 8:11 am

Could explain why I have been having difficulty replicating the issue.

Thank you for the feedback.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2348
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to C and C++

Who is online

Users browsing this forum: No registered users and 1 guest