Pico Technology SDK Hints and Tips

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

Pico Technology SDK Hints and Tips

Post by Hitesh »

Hi,

Below are some hints and tips which might be useful when developing your own applications using the Pico Technology SDK:

Drivers and Data Types
  • Ensure that you are using the correct driver for your device as per the table in this post - for example, the PicoScope 2204A and 2205A use the ps2000 driver.
  • Use the correct data type for the API function that your application is calling - use the closest match if this is not possible e.g. Integer for uint32_t in Excel Visual Basic for Applications (VBA)
Enumeration Values

For languages such as VBA refer to the corresponding C header file for the driver for the enumeration values. Rather than passing the name of the enumeration, pass the integer value for the enumeration. The first item in the enumeration list will normally have a numerical value of 0.

For example, when calling the ps3000aSetChannel() function for PicoScope 3000 Series PC Oscilloscopes using the ps3000a driver API functions, a PS3000A_CHANNEL enumeration value is required for the channel argument. Referring to the ps3000aApi.h file (which can be found in the inc folder of the SDK installer), the enumeration list is defined as:

Code: Select all

typedef enum enPS3000AChannel
{
  PS3000A_CHANNEL_A,
  PS3000A_CHANNEL_B,
  PS3000A_CHANNEL_C,
  PS3000A_CHANNEL_D,
  PS3000A_EXTERNAL,
  PS3000A_MAX_CHANNELS = PS3000A_EXTERNAL,
  PS3000A_TRIGGER_AUX,
  PS3000A_MAX_TRIGGER_SOURCES
} PS3000A_CHANNEL;
To specify channel A, use the value 0, use 1 for channel B and so on to select the correct value from the list.

Status Codes

Refer to the PicoStatus.h C header file in the SDK installation directory – integers need to be converted to a Hexadecimal number for comparison for C#, Excel VBA, MATLAB, NI LabVIEW, and VB .NET, unless they have been defined as integer values in the relevant files.

For example, if a status code of 282 is returned when calling ps5000aOpenUnit() for a PicoScope 5000A/B Series Oscilloscope, this corresponds to a Hex value of 0x11A which is PICO_POWER_SUPPLY_NOT_CONNECTED.

Not all status codes indicate an error, for example PICO_BUSY indicates that the device is busy collecting data, so these should be handled accordingly.

PicoScope Specific
  • Use the psXXXXGetTimebase() function to verify that the timebase index selected for block mode captures and the maximum number of samples per channel.
  • To use the fastest sampling interval, enable a single channel (Channel A only for 2000 Series) – by default all channels will be enabled on a device when it is opened.
  • For the PicoScope 5000A/B Series oscilloscopes, the selected resolution will also determine the fastest sampling interval.
  • Rapid Block captures: psXXXXGetValuesBulk function – pass an array for the overflow argument or NULL.
  • For block, rapid block and ETS mode captures, wait until the device is ready (either via the callback or by polling the relevant ‘IsReady()’ function before attempting to retrieve data.
  • For PicoScope drivers, some signal generator parameters can be changed while waiting for a trigger using the appropriate psXXXXSetSigGenPropertiesBuiltIn() or psXXXXSetSigGenPropertiesArbitrary() function.
Wrapper Libraries
  • Ensure Microsoft Visual C++ 2010 Redistributable (x68 for 32-bit and x64 for 64-bit) is installed – the SDK installer will do this.
  • Place the wrapper library files somewhere in a location on the Windows PATH Environment variable if moving them from the default SDK installation lib direction.
Hope this helps :D

DexJ
Newbie
Posts: 0
Joined: Tue Jun 20, 2023 6:55 pm

Re: Pico Technology SDK Hints and Tips

Post by DexJ »

Hello, I'm currently using a PicoScope 2204A and MATLAB R2023a. I just have a few clarifying questions with regards to the PS2000_ID_FastStreaming_SimpleTrig_Example and how the function names/ methods differ from the API Functions found in the PicoScope 2000 Programmers Manual.

For example,
% Set channels:
% Channel : 0 (ps2000Enuminfo.enPS2000Channel.PS2000_CHANNEL_A)
% Enabled : 1 (PicoConstants.TRUE)
% DC : 1 (DC Coupling)
% Range : 7 (ps2000Enuminfo.enPS2000Range.PS2000_2V)
[status.setChA] = invoke(ps2000DeviceObj, 'ps2000SetChannel', 0, 1, 1, 7);

compared to "ps2000_set_channel"
short ps2000_set_channel ( short handle, short channel, short enabled, short dc, short range )

I understand this is just nomenclature, but is there a list of MATLAB specific method names with descriptions that follows the example. I'm asking all of this because in my App Program I want to be able to get vertical offset/ scale, horizontal position/ scale, voltage per division and store these values in variables. Please don't hesitate to reply as I am happy to explain more of the program.

Post Reply