Picoscope 2000 Series A API Programmers Guide
Picoscope 2000 Series A API Programmers Guide
Programmer's Guide
ps2000apg.en r9
Copyright © 2011–2016 Pico Technology Ltd. All rights reserved.
PicoScope 2000 Series (A API) Programmer's Guide I
Contents
1 Introduction ................................................................................................................................ 1
1 Overview ............................................................................................................................................ 1
2 PC requirements ................................................................................................................................. 2
3 Legal information ............................................................................................................................... 3
2 Concepts ..................................................................................................................................... 4
1 Driver ................................................................................................................................................ 4
2 System requirements .......................................................................................................................... 4
3 General procedure .............................................................................................................................. 4
4 Voltage ranges .................................................................................................................................... 5
5 MSO digital data ................................................................................................................................. 6
6 Triggering ........................................................................................................................................... 6
7 Sampling modes .................................................................................................................................. 7
1 Block mode ............................................................................................................................ 8
2 Rapid block mode ................................................................................................................. 10
3 ETS (Equivalent Time Sampling) ............................................................................................ 15
4 Streaming mode .................................................................................................................... 17
5 Retrieving stored data ........................................................................................................... 19
8 Timebases ........................................................................................................................................ 20
9 MSO digital connector diagram ......................................................................................................... 21
10 Combining several oscilloscopes ...................................................................................................... 21
3 API functions ............................................................................................................................ 22
1 ps2000aBlockReady .......................................................................................................................... 24
2 ps2000aCloseUnit ............................................................................................................................ 25
3 ps2000aDataReady ........................................................................................................................... 26
4 ps2000aEnumerateUnits ................................................................................................................... 27
5 ps2000aFlashLed .............................................................................................................................. 28
6 ps2000aGetAnalogueOffset ............................................................................................................... 29
7 ps2000aGetChannelInformation ........................................................................................................ 30
8 ps2000aGetMaxDownSampleRatio .................................................................................................... 31
9 ps2000aGetMaxSegments ................................................................................................................. 32
10 ps2000aGetNoOfCaptures .............................................................................................................. 33
11 ps2000aGetNoOfProcessedCaptures ............................................................................................... 34
12 ps2000aGetStreamingLatestValues .................................................................................................. 35
13 ps2000aGetTimebase ...................................................................................................................... 36
14 ps2000aGetTimebase2 .................................................................................................................... 37
15 ps2000aGetTriggerTimeOffset ........................................................................................................ 38
16 ps2000aGetTriggerTimeOffset64 .................................................................................................... 39
17 ps2000aGetUnitInfo ....................................................................................................................... 40
18 ps2000aGetValues .......................................................................................................................... 41
1 Downsampling modes ........................................................................................................... 42
19 ps2000aGetValuesAsync ................................................................................................................. 43
20 ps2000aGetValuesBulk ................................................................................................................... 44
21 ps2000aGetValuesOverlapped ........................................................................................................ 45
1 Using the GetValuesOverlapped functions .............................................................................. 46
22 ps2000aGetValuesOverlappedBulk .................................................................................................. 47
23 ps2000aGetValuesTriggerTimeOffsetBulk ....................................................................................... 48
24 ps2000aGetValuesTriggerTimeOffsetBulk64 .................................................................................... 50
25 ps2000aHoldOff ............................................................................................................................. 51
26 ps2000aIsReady .............................................................................................................................. 52
27 ps2000aIsTriggerOrPulseWidthQualifierEnabled ............................................................................. 53
28 ps2000aMaximumValue .................................................................................................................. 54
29 ps2000aMemorySegments ............................................................................................................... 55
30 ps2000aMinimumValue ................................................................................................................... 56
31 ps2000aNoOfStreamingValues ........................................................................................................ 57
32 ps2000aOpenUnit .......................................................................................................................... 58
33 ps2000aOpenUnitAsync .................................................................................................................. 59
34 ps2000aOpenUnitProgress .............................................................................................................. 60
35 ps2000aPingUnit ............................................................................................................................ 61
36 ps2000aRunBlock ........................................................................................................................... 62
37 ps2000aRunStreaming .................................................................................................................... 64
38 ps2000aSetChannel ........................................................................................................................ 66
39 ps2000aSetDataBuffer .................................................................................................................... 67
40 ps2000aSetDataBuffers ................................................................................................................... 68
41 ps2000aSetDigitalAnalogTriggerOperand ........................................................................................ 69
42 ps2000aSetDigitalPort .................................................................................................................... 70
43 ps2000aSetEts ................................................................................................................................ 71
44 ps2000aSetEtsTimeBuffer ............................................................................................................... 72
45 ps2000aSetEtsTimeBuffers .............................................................................................................. 73
46 ps2000aSetNoOfCaptures ............................................................................................................... 74
47 ps2000aSetPulseWidthDigitalPortProperties ................................................................................... 75
48 ps2000aSetPulseWidthQualifier ...................................................................................................... 76
1 PS2000A_PWQ_CONDITIONS structure ............................................................................. 78
49 ps2000aSetSigGenArbitrary ............................................................................................................ 79
1 AWG index modes ............................................................................................................... 81
2 Calculating deltaPhase ........................................................................................................... 82
50 ps2000aSetSigGenBuiltIn ................................................................................................................ 83
51 ps2000SetSigGenBuiltInV2 .............................................................................................................. 85
52 ps2000aSetSigGenPropertiesArbitrary ............................................................................................. 86
53 ps2000aSetSigGenPropertiesBuiltIn ................................................................................................. 87
54 ps2000aSetSimpleTrigger ................................................................................................................ 88
55 ps2000aSetTriggerChannelConditions ............................................................................................. 89
1 PS2000A_TRIGGER_CONDITIONS structure ....................................................................... 90
56 ps2000aSetTriggerChannelDirections .............................................................................................. 91
57 ps2000aSetTriggerChannelProperties .............................................................................................. 92
1 PS2000A_TRIGGER_CHANNEL_PROPERTIES structure ...................................................... 93
58 ps2000aSetTriggerDelay ................................................................................................................. 95
59 ps2000aSetTriggerDigitalPortProperties .......................................................................................... 96
1 PS2000A_DIGITAL_CHANNEL_DIRECTIONS structure ....................................................... 97
60 ps2000aSigGenArbitraryMinMaxValues ........................................................................................... 98
61 ps2000aSigGenFrequencyToPhase ................................................................................................... 99
62 ps2000aSigGenSoftwareControl .................................................................................................... 100
63 ps2000aStop ................................................................................................................................. 101
64 ps2000aStreamingReady ............................................................................................................... 102
65 Wrapper functions ........................................................................................................................ 103
4 Further information ................................................................................................................ 105
1 Programming examples ................................................................................................................... 105
2 Driver status codes ......................................................................................................................... 105
3 Enumerated types and constants ...................................................................................................... 105
4 Numeric data types ......................................................................................................................... 105
5 Glossary ................................................................................................................................. 106
Index ......................................................................................................................................... 109
1 Introduction
1.1 Overview
The PicoScope 2000 Series PC Oscilloscopes from Pico Technology are high-speed
real-time measuring instruments. They obtain their power from the USB port, so they
do not need an additional power supply. With an arbitrary waveform generator these
scopes contain everything you need in a convenient, portable unit.
This manual explains how to develop your own programs for collecting and analyzing
data from the PicoScope 2000 Series oscilloscopes. It applies to all devices supported
by the 'ps2000a' application programming interface (API), as listed below:
The Pico Software Development Kit (SDK) is available free of charge from
www.picotech.com/downloads. This download includes support for all PicoScope
oscilloscopes including the ps2000a API described in this manual, as well as the
original ps2000 API for older oscilloscopes in the PicoScope 2000 Series.
1.2 PC requirements
To ensure that your PicoScope 2000 Series PC Oscilloscope operates correctly with
the SDK, you must have a computer with at least the minimum system requirements
to run one of the supported operating systems, as shown in the following table. The
performance of the oscilloscope will be better with a more powerful PC, and will benefit
from a multi-core processor.
Item Specification
Operating Windows XP (SP3) or later (not Windows RT)
system 32-bit and 64-bit
Processor
Memory As required by Windows
Free disk space
USB 2.0 or USB 3.0 port
Ports*
USB 1.1 port (absolute minimum)
* PicoScope oscilloscopes will operate slowly on a USB 1.1 port. Not recommended.
USB 3.0 connections will run at about the same speed as USB 2.0.
Access. The licensee agrees to allow access to this software only to persons who have
been informed of these conditions and agree to abide by them.
Usage. The software in this release is for use only with Pico products or with data
collected using Pico products.
Copyright. Pico Technology Ltd. claims the copyright of, and retains the rights to, all
material (software, documents, etc.) contained in this SDK except the example
programs. You may copy and distribute the SDK without restriction, as long as you do
not remove any Pico Technology copyright statements. The example programs in the
SDK may be modified, copied and distributed for the purpose of developing programs
to collect data using Pico products.
Liability. Pico Technology and its agents shall not be liable for any loss, damage or
injury, howsoever caused, related to the use of Pico Technology equipment or
software, unless excluded by statute.
Fitness for purpose. As no two applications are the same, Pico Technology cannot
guarantee that its equipment or software is suitable for a given application. It is your
responsibility, therefore, to ensure that the product is suitable for your application.
Viruses. This software was continuously monitored for viruses during production, but
you are responsible for virus-checking the software once it is installed.
Support. If you are dissatisfied with the performance of this software, please contact
our technical support staff, who will try to fix the problem within a reasonable time. If
you are still dissatisfied, please return the product and software to your supplier within
14 days of purchase for a full refund.
2 Concepts
2.1 Driver
Your application will communicate with a PicoScope 2000 (A API) driver called
ps2000a.dll, which is supplied in 32-bit and 64-bit versions. The driver exports the
ps2000a function definitions in standard C format, but this does not limit you to
programming in C. You can use the API with any programming language that supports
standard C calls.
The API driver depends on another DLL, picoipp.dll (which is supplied in 32-bit and
64-bit versions) and a low-level driver called WinUsb.sys. These are installed by the
SDK and configured when you plug the oscilloscope into each USB port for the first
time. Your application does not call these drivers directly.
USB
The ps2000a driver offers four different sampling modes (methods of recording data)
all of which support USB 1.1, USB 2.0 and USB 3.0. The fastest transfer rates are
achieved using USB 2.0 or USB 3.0.
Note: USB 3.0 connections will run at about the same speed as USB 2.0.
Many sample programs are included in the SDK. These demonstrate how to use the
functions of the driver software in each of the modes available.
Example
1. Call
ps2000aSetChannel
with range set to
PS2000A_1V.
A PicoScope MSO has two 8-bit digital ports—PORT0 and PORT1—making a total of 16
digital channels.
The data from each port is returned in a separate buffer that is set up by the
ps2000aSetDataBuffer and ps2000aSetDataBuffers functions. For compatibility with
the analog channels, each buffer is an array of 16-bit words. The 8-bit port data
occupies the lower 8 bits of the word, and the upper 8 bits of the word are undefined.
2.6 Triggering
PicoScope oscilloscopes can either start collecting data immediately or be programmed
to wait for a trigger event. In both cases you need to use the trigger functions:
· ps2000aSetTriggerChannelConditions
· ps2000aSetTriggerChannelDirections
· ps2000aSetTriggerChannelProperties
Alternatively you can call ps2000aSetSimpleTrigger, which in turn calls all three of
the above functions and allows you to set up triggers more quickly in simple cases.
A trigger event can occur when one of the signal or trigger input channels crosses a
threshold voltage on either a rising or a falling edge. It is also possible to combine two
inputs using the logic trigger function.
To set up pulse width, delay and dropout triggers, you can also call the pulse width
qualifier function:
· ps2000aSetPulseWidthQualifier
Block mode. In this mode, the scope stores data in internal buffer memory and
then transfers it to the PC. When the data has been collected it is possible to
examine the data, with an optional downsampling factor. The data is lost when a
new run is started in the same segment, the settings are changed, or the scope is
powered down.
ETS mode. In this mode, it is possible to increase the effective sampling rate of the
scope when capturing repetitive signals. It is a modified form of block mode.
Rapid block mode. This is a variant of block mode that allows you to capture more
than one waveform at a time with a minimum of delay between captures. You can
use downsampling in this mode if you wish.
Streaming mode. In this mode, data is passed directly to the PC without being
stored in the scope's internal buffer memory. This enables long periods of data
collection for chart recorder and data-logging applications. Streaming mode
supports downsampling and triggering, while providing fast streaming at typical
rates of 1 to 10 MS/s, as specified in the data sheet for your device.
In all sampling modes, the driver returns data asynchronously using a callback. This is
a call to one of the functions in your own application. When you request data from the
scope, you pass to the driver a pointer to your callback function. When the driver has
written the data to your buffer, it makes a callback (calls your function) to signal that
the data is ready. The callback function then signals to the application that the data is
available.
Because the callback is called asynchronously from the rest of your application, in a
separate thread, you must ensure that it does not corrupt any global variables while it
runs.
Block size. The maximum number of values depends upon the size of the
oscilloscope's memory. The memory buffer is shared between the enabled channels,
so if two channels are enabled, each receives half the memory, and if four channels
are enabled, each receives a quarter of the memory. These features are handled
transparently by the driver. The block size also depends on the number of memory
segments in use (see ps2000aMemorySegments).
* The PicoScope MSO models behave differently. If only the two analog channels or
only the two digital ports are enabled, each receives half the memory. If any
combination of one or two analog channels and one or two digital ports is enabled,
each receives a quarter of the memory.
Setup time. The driver normally performs a number of setup operations, which can
take up to 50 milliseconds, before collecting each block of data. If you need to
collect data with the minimum time interval between blocks, use rapid block mode
and avoid calling setup functions between calls to ps2000aRunBlock, ps2000aStop
and ps2000aGetValues.
Downsampling. When the data has been collected, you can set an optional
downsampling factor and examine the data. Downsampling is a process that
reduces the amount of data by combining adjacent samples. It is useful for zooming
in and out of the data without having to repeatedly transfer the entire contents of
the scope's buffer to the PC.
Data retention. The data is lost when a new run is started in the same segment,
the settings are changed, or the scope is powered down.
Note: Use the * steps when using the digital ports on MSO models.
Rapid block mode allows you to sample several waveforms at a time with the
minimum time between waveforms. It reduces the gap from milliseconds to less than
2 microseconds (on the fastest timebase).
Note: Use the * steps when using the digital ports on the mixed-signal (MSO) models.
Without aggregation
1. Open the oscilloscope using ps2000aOpenUnit.
2. Select channel ranges and AC/DC coupling using ps2000aSetChannel.
2*. Set the digital port using ps2000aSetDigitalPort.
3. Using ps2000aGetTimebase, select timebases until the required nanoseconds per
sample is located.
4. Use the trigger setup functions ps2000aSetTriggerChannelConditions,
ps2000aSetTriggerChannelDirections and
ps2000aSetTriggerChannelProperties to set up the trigger if required.
4*. Use the trigger setup functions ps2000aSetTriggerDigitalPortProperties to
set up the digital trigger if required.
5. Set the number of memory segments equal to or greater than the number of
captures required using ps2000aMemorySegments. Use ps2000aSetNoOfCaptures
before each run to specify the number of waveforms to capture.
6. Start the oscilloscope running using ps2000aRunBlock.
7. Wait until the oscilloscope is ready using the ps2000aIsReady or wait on the
callback function.
8. Use ps2000aSetDataBuffer to tell the driver where your memory buffers are.
Call the function once for each channel/segment combination for which you
require data. For greater efficiency, these calls can be made outside the loop,
between steps 5 and 6.
9. Transfer the blocks of data from the oscilloscope using ps2000aGetValuesBulk.
10. Retrieve the time offset for each data segment using
ps2000aGetValuesTriggerTimeOffsetBulk64.
11. Display the data.
12. Repeat steps 6 to 11 if necessary.
13. Stop the oscilloscope using ps2000aStop.
With aggregation
To use rapid block mode with aggregation, follow steps 1 to 7 above and then:
pParameter = false;
ps2000aRunBlock
(
handle,
0, // noOfPreTriggerSamples
MAX_SAMPLES, // noOfPostTriggerSamples
1, // timebase to be used
1,
&timeIndisposedMs,
0, // segment index
lpReady,
&pParameter
);
Comment: these variables have been set as an example and can be any valid value.
pParameter will be set true by your callback function lpReady.
ps2000aGetValuesBulk
(
handle,
&noOfSamples, // set to MAX_SAMPLES on entering the
function
10, // fromSegmentIndex
19, // toSegmentIndex
1, // downsampling ratio
PS2000A_RATIO_MODE_NONE, // downsampling ratio mode
overflow // an array of size 10 int16_t
)
Comments: See the earlier snippets for code to set up the segment buffers.
ps2000aGetValuesTriggerTimeOffsetBulk64
(
handle,
times,
timeUnits,
10,
19
)
Comments: the above segments start at 10 and finish at 19 inclusive. It is possible for
the fromSegmentIndex to wrap around to the toSegmentIndex, if the
fromSegmentIndex is set to 28 and the toSegmentIndex to 7.
pParameter = false;
ps2000aRunBlock
(
handle,
0, // noOfPreTriggerSamples,
MAX_SAMPLES, // noOfPostTriggerSamples,
1, // timebase to be used,
1,
&timeIndisposedMs,
1, // SegmentIndex
lpReady,
&pParameter
);
Comments: the set-up for running the device is exactly the same whether or not
aggregation will be used when you retrieve the samples.
Comments: since only one waveform will be retrieved at a time, you only need to set
up one pair of buffers; one for the maximum samples and one for the minimum
samples. Again, the buffer sizes are 1000 (MAX_SAMPLES) samples.
ps2000aGetValues
(
handle,
0,
&noOfSamples, // set to MAX_SAMPLES on entering
10,
&downSampleRatioMode, //set to RATIO_MODE_AGGREGATE
index,
overflow
);
ps2000aGetTriggerTimeOffset64
(
handle,
&time,
&timeUnits,
index
)
Comments: each waveform is retrieved one at a time from the driver with an
aggregation of 10.
Trigger stability. Because of the high sensitivity of ETS mode to small time
differences, the trigger must be set up to provide a stable waveform that varies as
little as possible from one capture to the next.
Callback. ETS mode calls the ps2000aBlockReady callback function when a new
waveform is ready for collection. The ps2000aGetValues function needs to be called
for the waveform to be retrieved.
Memory segmentation. The memory can be divided into segments to reduce the
latency of data transfers to the PC. However, this increases the risk of losing data if
the PC cannot keep up with the device's sampling rate.
Note: Please use the * steps when using the digital ports on the mixed-signal (MSO)
models.
9. Request new views of stored data using different downsampling parameters: see
Retrieving stored data.
2.8 Timebases
The ps2000a API allows you to select any of 232 different timebases based on the
maximum sampling rate† of your oscilloscope. The timebases allow slow enough
sampling in block mode to overlap the streaming sample intervals, so that you can
make a smooth transition between block mode and streaming mode. Calculate the
timebase using the ps2000aGetTimebase call.
1 10 ns
2 20 ns
n / 100,000,000 3 => 30 ns
3 to 232–1 ...
232–1 => ~ 43 s
† The fastest available sampling rate may depend on which channels are enabled, and on the sampling
mode. Refer to the oscilloscope data sheet for sampling rate specifications. In streaming mode the
sampling rate may additionally be limited by the speed of the USB port.
* Available only in single-channel mode.
** Not available when channel B active, nor when channel A and both digital ports active.
ETS mode
In ETS mode the sample time is not set according to the above tables but is instead
calculated and returned by ps2000aSetEts.
CALLBACK ps2000aBlockReady(...)
// define callback function specific to application
handle1 = ps2000aOpenUnit()
handle2 = ps2000aOpenUnit()
ps2000aSetChannel(handle1)
// set up unit 1
ps2000aSetDigitalPort // only when using MSO
ps2000aRunBlock(handle1)
ps2000aSetChannel(handle2)
// set up unit 2
ps2000aSetDigitalPort // only when using MSO
ps2000aRunBlock(handle2)
ready = FALSE
while not ready
ready = handle1_ready
ready &= handle2_ready
3 API functions
The ps2000a API exports the following functions for you to use in your own
applications. All functions are C functions using the standard call naming convention
(__stdcall). They are all exported with both decorated and undecorated names.
3.1 ps2000aBlockReady
typedef void (CALLBACK *ps2000aBlockReady)
(
int16_t handle,
PICO_STATUS status,
void * pParameter
)
This callback function is part of your application. You register it with the ps2000a
driver using ps2000aRunBlock, and the driver calls it back when block-mode data is
ready. You can then download the data using the ps2000aGetValues function.
3.2 ps2000aCloseUnit
PICO_STATUS ps2000aCloseUnit
(
int16_t handle
)
Returns PICO_OK
PICO_HANDLE_INVALID
PICO_USER_CALLBACK
PICO_DRIVER_FUNCTION
3.3 ps2000aDataReady
typedef void (__stdcall *ps2000aDataReady)
(
int16_t handle,
PICO_STATUS status,
uint32_t noOfSamples,
int16_t overflow,
void * pParameter
)
This is a callback function that you write to collect data from the driver. You supply a
pointer to the function when you call ps2000aGetValuesAsync, and the driver calls
your function back when the data is ready.
3.4 ps2000aEnumerateUnits
PICO_STATUS ps2000aEnumerateUnits
(
int16_t * count,
int8_t * serials,
int16_t * serialLth
)
This function counts the number of PicoScope 2000 Series (A API) units connected to
the computer, and returns a list of serial numbers as a string.
Example: AQ005/139,VDR61/356,ZOR14/107
3.5 ps2000aFlashLed
PICO_STATUS ps2000aFlashLed
(
int16_t handle,
int16_t start
)
This function flashes the LED on the front of the scope without blocking the calling
thread. Calls to ps2000aRunStreaming and ps2000aRunBlock cancel any flashing
started by this function. It is not possible to set the LED to be constantly illuminated,
as this state is used to indicate that the scope has not been initialized.
3.6 ps2000aGetAnalogueOffset
PICO_STATUS ps2000aGetAnalogueOffset
(
int16_t handle,
PS2000A_RANGE range,
PS2000A_COUPLING coupling
float * maximumVoltage,
float * minimumVoltage
)
This function is used to get the maximum and minimum allowable analog offset for a
specific voltage range.
range, the voltage range to be used when gathering the min and
max information.
3.7 ps2000aGetChannelInformation
PICO_STATUS ps2000aGetChannelInformation
(
int16_t handle,
PS2000A_CHANNEL_INFO info
int32_t probe
int32_t * ranges
int32_t * length
int32_t channels
)
3.8 ps2000aGetMaxDownSampleRatio
PICO_STATUS ps2000aGetMaxDownSampleRatio
(
int16_t handle,
uint32_t noOfUnaggregatedSamples,
uint32_t * maxDownSampleRatio,
PS2000A_RATIO_MODE downSampleRatioMode,
uint16_t segmentIndex
)
This function returns the maximum downsampling ratio that can be used for a given
number of samples in a given downsampling mode.
3.9 ps2000aGetMaxSegments
PICO_STATUS ps2000aGetMaxSegments
(
int16_t handle,
uint16_t * maxsegments
)
This function returns the maximum number of segments allowed for the opened
variant. Refer to ps2000aMemorySegments for specific figures.
3.10 ps2000aGetNoOfCaptures
PICO_STATUS ps2000aGetNoOfCaptures
(
int16_t handle,
uint32_t * nCaptures
)
This function finds out how many captures are available in rapid block mode after
ps2000aRunBlock has been called when either the collection completed or the
collection of waveforms was interrupted by calling ps2000aStop. The returned value
(nCaptures) can then be used to iterate through the number of segments using
ps2000aGetValues, or in a single call to ps2000aGetValuesBulk where it is used to
calculate the toSegmentIndex parameter.
3.11 ps2000aGetNoOfProcessedCaptures
PICO_STATUS ps2000aGetNoOfProcessedCaptures
(
int16_t handle,
uint32_t * nCaptures
)
This function finds out how many captures in rapid block mode have been processed
after ps2000aRunBlock has been called when either the collection completed or the
collection of waveforms was interrupted by calling ps2000aStop. The returned value
(nCaptures) can then be used to iterate through the number of segments using
ps2000aGetValues, or in a single call to ps2000aGetValuesBulk where it is used to
calculate the toSegmentIndex parameter.
3.12 ps2000aGetStreamingLatestValues
PICO_STATUS ps2000aGetStreamingLatestValues
(
int16_t handle,
ps2000aStreamingReady lpPs2000AReady,
void * pParameter
)
This function instructs the driver to return the next block of values to your
ps2000aStreamingReady callback function. You must have previously called
ps2000aRunStreaming beforehand to set up streaming.
3.13 ps2000aGetTimebase
PICO_STATUS ps2000aGetTimebase
(
int16_t handle,
uint32_t timebase,
int32_t noSamples,
int32_t * timeIntervalNanoseconds,
int16_t oversample,
int32_t * maxSamples
uint16_t segmentIndex
)
This function calculates the sampling rate and maximum number of samples for a
given timebase under the specified conditions. The result will depend on the number of
channels enabled by the last call to ps2000aSetChannel.
This function is provided for use with programming languages that do not support the
float data type. The value returned in the timeIntervalNanoseconds argument is
restricted to integers. If your programming language supports the float type, we
recommend that you use ps2000aGetTimebase2 instead.
3.14 ps2000aGetTimebase2
PICO_STATUS ps2000aGetTimebase2
(
int16_t handle,
uint32_t timebase,
int32_t noSamples,
float * timeIntervalNanoseconds,
int16_t oversample,
int32_t * maxSamples
uint16_t segmentIndex
)
3.15 ps2000aGetTriggerTimeOffset
PICO_STATUS ps2000aGetTriggerTimeOffset
(
int16_t handle
uint32_t * timeUpper
uint32_t * timeLower
PS2000A_TIME_UNITS * timeUnits
uint16_t segmentIndex
)
This function gets the time, as two 4-byte values, at which the trigger occurred. Call it
after block-mode data has been captured or when data has been retrieved from a
previous block-mode capture. A 64-bit version of this function,
ps2000aGetTriggerTimeOffset64, is also available.
3.16 ps2000aGetTriggerTimeOffset64
PICO_STATUS ps2000aGetTriggerTimeOffset64
(
int16_t handle,
int64_t * time,
PS2000A_TIME_UNITS * timeUnits,
uint16_t segmentIndex
)
This function gets the time, as a single 64-bit value, at which the trigger occurred. Call
it after block-mode data has been captured or when data has been retrieved from a
previous block-mode capture. A 32-bit version of this function,
ps2000aGetTriggerTimeOffset, is also available.
3.17 ps2000aGetUnitInfo
PICO_STATUS ps2000aGetUnitInfo
(
int16_t handle,
int8_t * string,
int16_t stringLength,
int16_t * requiredSize
PICO_INFO info
)
This function retrieves information about the specified oscilloscope. If the device fails
to open, or no device is opened only the driver version is available.
info Example
0 PICO_DRIVER_VERSION 1,0,0,1
Version number of PicoScope 2000A DLL
1 PICO_USB_VERSION 2.0
Type of USB connection to device: 1.1 or 2.0
2 PICO_HARDWARE_VERSION 1
Hardware version of device
3 PICO_VARIANT_INFO 2206
Variant number of device
4 PICO_BATCH_AND_SERIAL KJL87/6
Batch and serial number of device
5 PICO_CAL_DATE 30Sep09
Calibration date of device
6 PICO_KERNEL_VERSION 1,1,2,4
Version of kernel driver
7 PICO_DIGITAL_HARDWARE_VERSION 1
Hardware version of the digital section
8 PICO_ANALOGUE_HARDWARE_VERSION 1
Hardware version of the analog section
9 PICO_FIRMWARE_VERSION_1 1.0.0.0
10 PICO_FIRMWARE_VERSION_2 1.0.0.0
3.18 ps2000aGetValues
PICO_STATUS ps2000aGetValues
(
int16_t handle,
uint32_t startIndex,
uint32_t * noOfSamples,
uint32_t downSampleRatio,
PS2000A_RATIO_MODE downSampleRatioMode,
uint16_t segmentIndex,
int16_t * overflow
)
This function returns block-mode data, with or without downsampling, starting at the
specified sample number. It is used to get the stored data from the driver after data
collection has stopped.
Returns PICO_OK
PICO_INVALID_HANDLE
PICO_NO_SAMPLES_AVAILABLE
PICO_DEVICE_SAMPLING
PICO_NULL_PARAMETER
PICO_SEGMENT_OUT_OF_RANGE
PICO_STARTINDEX_INVALID
PICO_ETS_NOT_RUNNING
PICO_BUFFERS_NOT_SET
PICO_INVALID_PARAMETER
PICO_TOO_MANY_SAMPLES
PICO_DATA_NOT_AVAILABLE
PICO_STARTINDEX_INVALID
PICO_INVALID_SAMPLERATIO
PICO_INVALID_CALL
PICO_NOT_RESPONDING
PICO_MEMORY
PICO_RATIO_MODE_NOT_SUPPORTED
PICO_DRIVER_FUNCTION
You specify the downsampling mode when you call one of the data collection functions
such as ps2000aGetValues. The following modes are available:
3.19 ps2000aGetValuesAsync
PICO_STATUS ps2000aGetValuesAsync
(
int16_t handle,
uint32_t startIndex,
uint32_t noOfSamples,
uint32_t downSampleRatio,
PS2000A_RATIO_MODE downSampleRatioMode,
uint16_t segmentIndex,
void * lpDataReady,
void * pParameter
)
This function returns data either with or without downsampling, starting at the
specified sample number. It is used to get the stored data from the scope after data
collection has stopped. It returns the data using a callback.
3.20 ps2000aGetValuesBulk
PICO_STATUS ps2000aGetValuesBulk
(
int16_t handle,
uint32_t * noOfSamples,
uint16_t fromSegmentIndex,
uint16_t toSegmentIndex,
uint32_t downSampleRatio,
PS2000A_RATIO_MODE downSampleRatioMode,
int16_t * overflow
)
This function retrieves waveforms captured using rapid block mode. The waveforms
must have been collected sequentially and in the same run.
3.21 ps2000aGetValuesOverlapped
PICO_STATUS ps2000aGetValuesOverlapped
(
int16_t handle,
uint32_t startIndex,
uint32_t * noOfSamples,
uint32_t downSampleRatio,
PS2000A_RATIO_MODE downSampleRatioMode,
uint16_t segmentIndex,
int16_t * overflow
)
This function allows you to make a deferred data-collection request in block mode. The
request will be executed, and the arguments validated, when you call
ps2000aRunBlock. The advantage of this function is that the driver makes contact with
the scope only once, when you call ps2000aRunBlock, compared with the two contacts
that occur when you use the conventional ps2000aRunBlock, ps2000aGetValues
calling sequence. This slightly reduces the dead time between successive captures in
block mode.
5. Wait until the oscilloscope is ready using the ps2000aBlockReady callback (or
poll using ps2000aIsReady).
6. Use ps2000aSetDataBuffer to tell the driver where your memory buffer is.
7. Set up the transfer of the block of data from the oscilloscope using
ps2000aGetValuesOverlapped.
A similar procedure can be used with rapid block mode using the
ps2000aGetValuesOverlappedBulk function.
3.22 ps2000aGetValuesOverlappedBulk
PICO_STATUS ps2000aGetValuesOverlappedBulk
(
int16_t handle,
uint32_t startIndex,
uint32_t * noOfSamples,
uint32_t downSampleRatio,
PS2000A_RATIO_MODE downSampleRatioMode,
uint16_t fromSegmentIndex,
uint16_t toSegmentIndex,
int16_t * overflow
)
This function allows you to make a deferred data-collection request, which will later be
executed, and the arguments validated, when you call ps2000aRunBlock in rapid block
mode. The advantage of this method is that the driver makes contact with the scope
only once, when you call ps2000aRunBlock, compared with the two contacts that occur
when you use the conventional ps2000aRunBlock, ps2000aGetValuesBulk calling
sequence. This slightly reduces the dead time between successive captures in rapid
block mode.
3.23 ps2000aGetValuesTriggerTimeOffsetBulk
PICO_STATUS ps2000aGetValuesTriggerTimeOffsetBulk
(
int16_t handle,
uint32_t * timesUpper,
uint32_t * timesLower,
PS2000A_TIME_UNITS * timeUnits,
uint16_t fromSegmentIndex,
uint16_t toSegmentIndex
)
This function retrieves the time offsets, as lower and upper 32-bit values, for
waveforms obtained in rapid block mode. The time offset of a waveform is the delay
from the trigger sampling instant to the time at which the driver estimates the
waveform to have crossed the trigger threshold. You can add this offset to the time of
each sample in the waveform to reduce trigger jitter. Without using the time offset,
trigger jitter can be up to 1 sample period; adding the time offset reduces jitter to a
small fraction of a sample period.
This function is provided for use in programming environments that do not support 64-
bit integers. If your programming environment supports this data type, it is easier to
use ps2000aGetValuesTriggerTimeOffsetBulk64.
3.24 ps2000aGetValuesTriggerTimeOffsetBulk64
PICO_STATUS ps2000aGetValuesTriggerTimeOffsetBulk64
(
int16_t handle,
int64_t * times,
PS2000A_TIME_UNITS * timeUnits,
uint16_t fromSegmentIndex,
uint16_t toSegmentIndex
)
This function retrieves the 64-bit time offsets for waveforms captured in rapid block
mode.
* times, an array of integers. On exit, this will hold the time offset
for each requested segment index. times[0] will hold the time offset
for fromSegmentIndex, and the last times index will hold the time
offset for toSegmentIndex. The array must be long enough to hold
the number of times requested.
3.25 ps2000aHoldOff
PICO_STATUS ps2000aHoldOff
(
int16_t handle,
uint64_t holdoff,
PS2000A_HOLDOFF_TYPE type
)
3.26 ps2000aIsReady
PICO_STATUS ps2000aIsReady
(
int16_t handle,
int16_t * ready
)
This function may be used instead of a callback function to receive data from
ps2000aRunBlock. To use this method, pass a NULL pointer as the lpReady argument
to ps2000aRunBlock. You must then poll the driver to see if it has finished collecting
the requested samples.
3.27 ps2000aIsTriggerOrPulseWidthQualifierEnabled
PICO_STATUS ps2000aIsTriggerOrPulseWidthQualifierEnabled
(
int16_t handle,
int16_t * triggerEnabled,
int16_t * pulseWidthQualifierEnabled
)
Applicability Call after setting up the trigger, and just before calling either
ps2000aRunBlock or ps2000aRunStreaming.
Arguments handle, device identifier returned by ps2000aOpenUnit.
3.28 ps2000aMaximumValue
PICO_STATUS ps2000aMaximumValue
(
int16_t handle
int16_t * value
)
This function returns the maximum ADC count returned by calls to the "GetValues"
functions.
3.29 ps2000aMemorySegments
PICO_STATUS ps2000aMemorySegments
(
int16_t handle
uint16_t nSegments,
int32_t * nMaxSamples
)
This function sets the number of memory segments that the scope will use.
When the scope is opened, the number of segments defaults to 1, meaning that each
capture fills the scope's available memory. This function allows you to divide the
memory into a number of segments so that the scope can store several waveforms
sequentially.
3.30 ps2000aMinimumValue
PICO_STATUS ps2000aMinimumValue
(
int16_t handle
int16_t * value
)
This function returns the minimum ADC count returned by calls to the GetValues
functions.
3.31 ps2000aNoOfStreamingValues
PICO_STATUS ps2000aNoOfStreamingValues
(
int16_t handle,
uint32_t * noOfValues
)
This function returns the number of samples available after data collection in
streaming mode. Call it after calling ps2000aStop.
3.32 ps2000aOpenUnit
PICO_STATUS ps2000aOpenUnit
(
int16_t * handle,
int8_t * serial
)
This function opens a PicoScope 2000 Series (A API) scope attached to the computer.
The maximum number of units that can be opened depends on the operating system,
the kernel driver and the computer.
3.33 ps2000aOpenUnitAsync
PICO_STATUS ps2000aOpenUnitAsync
(
int16_t * status
int8_t * serial
)
This function opens a scope without blocking the calling thread. You can find out when
it has finished by periodically calling ps2000aOpenUnitProgress until that function
returns a non-zero value.
3.34 ps2000aOpenUnitProgress
PICO_STATUS ps2000aOpenUnitProgress
(
int16_t * handle,
int16_t * progressPercent,
int16_t * complete
)
3.35 ps2000aPingUnit
PICO_STATUS ps2000aPingUnit
(
int16_t handle
)
This function can be used to check that the already opened device is still connected to
the USB port and communication is successful.
Returns PICO_OK
PICO_INVALID_HANDLE
PICO_DRIVER_FUNCTION
PICO_BUSY
PICO_NOT_RESPONDING
3.36 ps2000aRunBlock
PICO_STATUS ps2000aRunBlock
(
int16_t handle,
int32_t noOfPreTriggerSamples,
int32_t noOfPostTriggerSamples,
uint32_t timebase,
int16_t oversample,
int32_t * timeIndisposedMs,
uint16_t segmentIndex,
ps2000aBlockReady lpReady,
void * pParameter
)
This function starts collecting data in block mode. For a step-by-step guide to this
process, see Using block mode.
PICO_USER_CALLBACK
PICO_SEGMENT_OUT_OF_RANGE
PICO_INVALID_CHANNEL
PICO_INVALID_TRIGGER_CHANNEL
PICO_INVALID_CONDITION_CHANNEL
PICO_TOO_MANY_SAMPLES
PICO_INVALID_TIMEBASE
PICO_NOT_RESPONDING
PICO_CONFIG_FAIL
PICO_INVALID_PARAMETER
PICO_NOT_RESPONDING
PICO_TRIGGER_ERROR
PICO_DRIVER_FUNCTION
PICO_FW_FAIL
PICO_NOT_ENOUGH_SEGMENTS (in Bulk mode)
PICO_PULSE_WIDTH_QUALIFIER
PICO_SEGMENT_OUT_OF_RANGE (in Overlapped mode)
PICO_STARTINDEX_INVALID (in Overlapped mode)
PICO_INVALID_SAMPLERATIO (in Overlapped mode)
PICO_CONFIG_FAIL
3.37 ps2000aRunStreaming
PICO_STATUS ps2000aRunStreaming
(
int16_t handle,
uint32_t * sampleInterval,
PS2000A_TIME_UNITS sampleIntervalTimeUnits
uint32_t maxPreTriggerSamples,
uint32_t maxPostTriggerSamples,
int16_t autoStop,
uint32_t downSampleRatio,
PS2000A_RATIO_MODE downSampleRatioMode,
uint32_t overviewBufferSize
)
This function tells the oscilloscope to start collecting data in streaming mode. When
data has been collected from the device it is downsampled if necessary and then
delivered to the application. Call ps2000aGetStreamingLatestValues to retrieve the
data. See Using streaming mode for a step-by-step guide to this process.
When a trigger is set, the total number of samples stored in the driver is the sum of
maxPreTriggerSamples and maxPostTriggerSamples. If autoStop is false, this will
become the maximum number of samples without downsampling.
autoStop, a flag that specifies if the streaming should stop when all
of maxSamples have been captured.
PICO_INVALID_HANDLE
PICO_ETS_MODE_SET
PICO_USER_CALLBACK
PICO_NULL_PARAMETER
PICO_INVALID_PARAMETER
PICO_STREAMING_FAILED
PICO_NOT_RESPONDING
PICO_TRIGGER_ERROR
PICO_INVALID_SAMPLE_INTERVAL
PICO_INVALID_BUFFER
PICO_DRIVER_FUNCTION
PICO_FW_FAIL
PICO_MEMORY
3.38 ps2000aSetChannel
PICO_STATUS ps2000aSetChannel
(
int16_t handle,
PS2000A_CHANNEL channel,
int16_t enabled,
PS2000A_COUPLING type,
PS2000A_RANGE range,
float analogOffset
)
This function specifies whether an input channel is to be enabled, its input coupling
type, voltage range, analog offset.
3.39 ps2000aSetDataBuffer
PICO_STATUS ps2000aSetDataBuffer
(
int16_t handle,
int32_t channel,
int16_t * buffer,
int32_t bufferLth,
uint16_t segmentIndex,
PS2000A_RATIO_MODE mode
)
This function tells the driver where to store the data, either unprocessed or
downsampled, that will be returned after the next call to one of the GetValues
functions. The function allows you to specify only a single buffer, so for aggregation
mode, which requires two buffers, you need to call ps2000aSetDataBuffers instead.
You must allocate memory for the buffer before calling this function.
Applicability Block, rapid block and streaming modes. All downsampling modes
except aggregation.
Arguments handle, device identifier returned by ps2000aOpenUnit.
channel, the channel you want to use with the buffer. Use one of
these values for analog channels:
PS2000A_CHANNEL_A
PS2000A_CHANNEL_B
PS2000A_CHANNEL_C
PS2000A_CHANNEL_D
To set the buffer for a digital port (MSO models only), use one of
these values:
PS2000A_DIGITAL_PORT0 = 0x80
PS2000A_DIGITAL_PORT1 = 0x81
3.40 ps2000aSetDataBuffers
PICO_STATUS ps2000aSetDataBuffers
(
int16_t handle,
int32_t channel,
int16_t * bufferMax,
int16_t * bufferMin,
int32_t bufferLth,
uint16_t segmentIndex,
PS2000A_RATIO_MODE mode
)
This function tells the driver the location of one or two buffers for receiving data. You
need to allocate memory for the buffers before calling this function. If you do not need
two buffers, because you are not using aggregate mode, you can optionally use
ps2000aSetDataBuffer instead.
channel, the channel for which you want to set the buffers. Use one
of these constants:
PS2000A_CHANNEL_A
PS2000A_CHANNEL_B
PS2000A_CHANNEL_C
PS2000A_CHANNEL_D
To set the buffer for a digital port (MSO models only), use one of
these values:
PS2000A_DIGITAL_PORT0 = 0x80
PS2000A_DIGITAL_PORT1 = 0x81
3.41 ps2000aSetDigitalAnalogTriggerOperand
PICO_STATUS ps2000aSetDigitalAnalogTriggerOperand
(
int16_t handle,
PS2000A_TRIGGER_OPERAND operand
)
Mixed-signal (MSO) models in this series have two independent triggers, one for the
analog input channels and another for the digital inputs. This function defines how the
two triggers are combined.
3.42 ps2000aSetDigitalPort
PICO_STATUS ps2000aSetDigitalPort
(
int16_t handle,
PS2000A_DIGITAL_PORT port,
int16_t enabled,
int16_t logiclevel
)
This function is used to enable the digital ports of an MSO and set the logic level (the
voltage point at which the state transitions from 0 to 1).
3.43 ps2000aSetEts
PICO_STATUS ps2000aSetEts
(
int16_t handle,
PS2000A_ETS_MODE mode,
int16_t etsCycles,
int16_t etsInterleave,
int32_t * sampleTimePicoseconds
)
This function is used to enable or disable ETS (equivalent-time sampling) and to set
the ETS parameters. See ETS overview for an explanation of ETS mode.
500 for the PicoScope 2206B, 2206B MSO, 2207B, 2207B MSO,
2208B, 2208B MSO, 2405A, 2406B, 2407B, 2408B
PS2206_MAX_ETS_CYCLES for the PicoScope 2206, 2206A
PS2207_MAX_ETS_CYCLES for the PicoScope 2207, 2207A
PS2208_MAX_ETS_CYCLES for the PicoScope 2208, 2208A
3.44 ps2000aSetEtsTimeBuffer
PICO_STATUS ps2000aSetEtsTimeBuffer
(
int16_t handle,
int64_t * buffer,
int32_t bufferLth
)
This function tells the driver where to find your application's ETS time buffers. These
buffers contain the 64-bit timing information for each ETS sample after you run a
block-mode ETS capture.
If your programming language does not support 64-bit data, use the
32-bit version ps2000aSetEtsTimeBuffers instead.
Arguments handle, device identifier returned by ps2000aOpenUnit.
3.45 ps2000aSetEtsTimeBuffers
PICO_STATUS ps2000aSetEtsTimeBuffers
(
int16_t handle,
uint32_t * timeUpper,
uint32_t * timeLower,
int32_t bufferLth
)
This function tells the driver where to find your application's ETS time buffers. These
buffers contain the timing information for each ETS sample after you run a block-mode
ETS capture. There are two buffers containing the upper and lower 32-bit parts of the
timing information, to allow programming languages that do not support 64-bit data to
retrieve the timings.
If your programming language supports 64-bit data then you can use
ps2000aSetEtsTimeBuffer instead.
Arguments handle, device identifier returned by ps2000aOpenUnit.
3.46 ps2000aSetNoOfCaptures
PICO_STATUS ps2000aSetNoOfCaptures
(
int16_t handle,
uint16_t nCaptures
)
This function sets the number of captures to be collected in one run of rapid block
mode. If you do not call this function before a run, the driver will capture only one
waveform. Once a value has been set, the value remains constant unless changed.
3.47 ps2000aSetPulseWidthDigitalPortProperties
PICO_STATUS ps2000aSetPulseWidthDigitalPortProperties
(
int16_t handle,
PS2000A_DIGITAL_CHANNEL_DIRECTIONS * directions
int16_t nDirections
)
This function will set the individual digital channels' pulse-width trigger directions.
Each trigger direction consists of a channel name and a direction. If the channel is not
included in the array of PS2000A_DIGITAL_CHANNEL_DIRECTIONS the driver assumes
the digital channel's pulse-width trigger direction is PS2000A_DIGITAL_DONT_CARE.
3.48 ps2000aSetPulseWidthQualifier
PICO_STATUS ps2000aSetPulseWidthQualifier
(
int16_t handle,
PS2000A_PWQ_CONDITIONS * conditions,
int16_t nConditions,
PS2000A_THRESHOLD_DIRECTION direction,
uint32_t lower,
uint32_t upper,
PS2000A_PULSE_WIDTH_TYPE type
)
This function sets up the conditions for pulse width qualification, which is used with
either threshold triggering, level triggering or window triggering to produce time-
qualified triggers.
direction, the direction of the signal required for the pulse width
trigger to fire. See PS2000A_THRESHOLD_DIRECTION constants for the
list of possible values. Each channel of the oscilloscope (except the
EXT input) has two thresholds for each direction—for example,
PS2000A_RISING and PS2000A_RISING_LOWER — so that one can be
used for the pulse-width qualifier and the other for the level trigger.
The driver will not let you use the same threshold for both triggers;
so, for example, you cannot use PS2000A_RISING as the direction
argument for both ps2000aSetTriggerConditions and
ps2000aSetPulseWidthQualifier at the same time. There is no such
restriction when using window triggers.
The resulting trigger condition is the logical AND of the conditions applied to all the
inputs. An array of these structures can be passed to
ps2000aSetPulseWidthQualifier, which ORs them to produce the final pulse width
qualifier. This method can generate any possible Boolean function of the scope's input
conditions.
The structure is byte-aligned. In C++, for example, you should specify this using the
#pragma pack() instruction.
3.49 ps2000aSetSigGenArbitrary
PICO_STATUS ps2000aSetSigGenArbitrary
(
int16_t handle,
int32_t offsetVoltage,
uint32_t pkToPk
uint32_t startDeltaPhase,
uint32_t stopDeltaPhase,
uint32_t deltaPhaseIncrement,
uint32_t dwellCount,
int16_t * arbitraryWaveform,
int32_t arbitraryWaveformSize,
PS2000A_SWEEP_TYPE sweepType,
PS2000A_EXTRA_OPERATIONS operation,
PS2000A_INDEX_MODE indexMode,
uint32_t shots,
uint32_t sweeps,
PS2000A_SIGGEN_TRIG_TYPE triggerType,
PS2000A_SIGGEN_TRIG_SOURCE triggerSource,
int16_t extInThreshold
)
The arbitrary waveform generator uses direct digital synthesis (DDS). It maintains a
32-bit phase accumulator that indicates the present location in the waveform. The top
bits of the phase accumulator are used as an index into a buffer containing the
arbitrary waveform. The remaining bits act as the fractional part of the index, enabling
high-resolution control of output frequency and allowing the generation of lower
frequencies.
startDeltaPhase, the initial value added to the phase accumulator as the generator
begins to step through the waveform buffer. Calculate this value from the information
above, or use ps2000aSigGenFrequencyToPhase.
stopDeltaPhase, the final value added to the phase accumulator before the
generator restarts or reverses the sweep. When frequency sweeping is not required,
set equal to startDeltaPhase.
deltaPhaseIncrement, the amount added to the delta phase value every time the
dwellCount period expires. This determines the amount by which the generator
sweeps the output frequency in each dwell period. When frequency sweeping is not
required, set to zero.
indexMode, specifies how the signal will be formed from the arbitrary waveform
data. Single and dual index modes are possible. Use one of these constants:
PS2000A_SINGLE
PS2000A_DUAL
shots,
0: sweep the frequency as specified by sweeps
1...PS2000A_MAX_SWEEPS_SHOTS: the number of cycles of the waveform to be
produced after a trigger event. sweeps must be zero.
PS2000A_SHOT_SWEEP_TRIGGER_CONTINUOUS_RUN: start and run continuously after
trigger occurs (not PicoScope 2205 MSO)
sweeps,
0: produce number of cycles specified by shots
1..PS2000A_MAX_SWEEPS_SHOTS: the number of times to sweep the frequency after
a trigger event, according to sweepType. shots must be zero.
triggerType, the type of trigger that will be applied to the signal generator:
PS2000A_SIGGEN_RISING trigger on rising edge
PS2000A_SIGGEN_FALLING trigger on falling edge
PS2000A_SIGGEN_GATE_HIGH run while trigger is high
PS2000A_SIGGEN_GATE_LOW run while trigger is low
3.50 ps2000aSetSigGenBuiltIn
PICO_STATUS ps2000aSetSigGenBuiltIn
(
int16_t handle,
int32_t offsetVoltage,
uint32_t pkToPk
int16_t waveType
float startFrequency,
float stopFrequency,
float increment,
float dwellTime,
PS2000A_SWEEP_TYPE sweepType,
PS2000A_EXTRA_OPERATIONS operation,
uint32_t shots,
uint32_t sweeps,
PS2000A_SIGGEN_TRIG_TYPE triggerType,
PS2000A_SIGGEN_TRIG_SOURCE triggerSource,
int16_t extInThreshold
)
This function sets up the signal generator to produce a signal from a list of built-in
waveforms. If different start and stop frequencies are specified, the device will sweep
either up, down, or up and down.
startFrequency, the frequency that the signal generator will initially produce.
Allowable values are between one of these constants:
PS2000A_MIN_FREQUENCY
PS2000A_PRBS_MIN_FREQUENCY
PS2000A_SINE_MAX_FREQUENCY
PS2000A_SQUARE_MAX_FREQUENCY
PS2000A_TRIANGLE_MAX_FREQUENCY
PS2000A_SINC_MAX_FREQUENCY
PS2000A_RAMP_MAX_FREQUENCY
PS2000A_HALF_SINE_MAX_FREQUENCY
PS2000A_GAUSSIAN_MAX_FREQUENCY
PS2000A_PRBS_MAX_FREQUENCY
dwellTime, the time for which the sweep stays at each frequency, in seconds.
3.51 ps2000SetSigGenBuiltInV2
PICO_STATUS ps2000aSetSigGenBuiltInV2
(
int16_t handle,
int32_t offsetVoltage,
uint32_t pkToPk
int16_t waveType
double startFrequency,
double stopFrequency,
double increment,
double dwellTime,
PS2000_SWEEP_TYPE sweepType,
PS2000_EXTRA_OPERATIONS operation,
uint32_t shots,
uint32_t sweeps,
PS2000_SIGGEN_TRIG_TYPE triggerType,
PS2000_SIGGEN_TRIG_SOURCE triggerSource,
int16_t extInThreshold
)
3.52 ps2000aSetSigGenPropertiesArbitrary
PICO_STATUS ps2000aSetSigGenPropertiesArbitrary
(
int16_t handle,
uint32_t startDeltaPhase,
uint32_t stopDeltaPhase,
uint32_t deltaPhaseIncrement,
uint32_t dwellCount,
PS2000A_SWEEP_TYPE sweepType,
uint32_t shots,
uint32_t sweeps,
PS2000A_SIGGEN_TRIG_TYPE triggerType,
PS2000A_SIGGEN_TRIG_SOURCE triggerSource,
int16_t extInThreshold
)
This function reprograms the arbitrary waveform generator. All values can be
reprogrammed while the signal generator is waiting for a trigger.
3.53 ps2000aSetSigGenPropertiesBuiltIn
PICO_STATUS ps2000aSetSigGenPropertiesBuiltIn
(
int16_t handle,
double startFrequency,
double stopFrequency,
double increment,
double dwellTime,
PS2000A_SWEEP_TYPE sweepType,
uint32_t shots,
uint32_t sweeps,
PS2000A_SIGGEN_TRIG_TYPE triggerType,
PS2000A_SIGGEN_TRIG_SOURCE triggerSource,
int16_t extInThreshold
)
This function reprograms the signal generator. Values can be changed while the signal
generator is waiting for a trigger.
3.54 ps2000aSetSimpleTrigger
PICO_STATUS ps2000aSetSimpleTrigger
(
int16_t handle,
int16_t enable,
PS2000A_CHANNEL source,
int16_t threshold,
PS2000A_THRESHOLD_DIRECTION direction,
uint32_t delay,
int16_t autoTrigger_ms
)
This function simplifies arming the trigger. It supports only the LEVEL trigger types
and does not allow more than one channel to have a trigger applied to it. Any previous
pulse width qualifier is canceled.
enable, zero to disable the trigger, any non-zero value to set the
trigger.
delay, the time between the trigger occurring and the first sample
being taken. For example, if delay=100 then the scope would wait
100 sample periods before sampling.
3.55 ps2000aSetTriggerChannelConditions
PICO_STATUS ps2000aSetTriggerChannelConditions
(
int16_t handle,
PS2000A_TRIGGER_CONDITIONS * conditions,
int16_t nConditions
)
This function sets up trigger conditions on the scope's inputs. The trigger is defined by
one or more PS2000A_TRIGGER_CONDITIONS structures that are then ORed together.
Each structure is itself the AND of the states of one or more of the inputs. This AND-
OR logic allows you to create any possible Boolean function of the scope's inputs.
Each structure is the logical AND of the states of the scope's inputs. The
ps2000aSetTriggerChannelConditions function can OR together a number of these
structures to produce the final trigger condition, which can be any possible Boolean
function of the scope's inputs.
The structure is byte-aligned. In C++, for example, you should specify this using the
#pragma pack() instruction.
3.56 ps2000aSetTriggerChannelDirections
PICO_STATUS ps2000aSetTriggerChannelDirections
(
int16_t handle,
PS2000A_THRESHOLD_DIRECTION channelA,
PS2000A_THRESHOLD_DIRECTION channelB,
PS2000A_THRESHOLD_DIRECTION channelC,
PS2000A_THRESHOLD_DIRECTION channelD,
PS2000A_THRESHOLD_DIRECTION ext,
PS2000A_THRESHOLD_DIRECTION aux
)
This function sets the direction of the trigger for each channel.
PS2000A_THRESHOLD_DIRECTION constants
Constant Trigger type Direction
PS2000A_ABOVE gated above the upper threshold
PS2000A_ABOVE_LOWER gated above the lower threshold
PS2000A_BELOW gated below the upper threshold
PS2000A_BELOW_LOWER gated below the lower threshold
PS2000A_RISING threshold rising edge, using upper threshold
PS2000A_RISING_LOWER threshold rising edge, using lower threshold
PS2000A_FALLING threshold falling edge, using upper threshold
PS2000A_FALLING_LOWER threshold falling edge, using lower threshold
PS2000A_RISING_OR_FALLING threshold either edge
PS2000A_INSIDE window-qualified inside window
PS2000A_OUTSIDE window-qualified outside window
PS2000A_ENTER window entering the window
PS2000A_EXIT window leaving the window
PS2000A_ENTER_OR_EXIT window entering or leaving the window
PS2000A_NONE none none
3.57 ps2000aSetTriggerChannelProperties
PICO_STATUS ps2000aSetTriggerChannelProperties
(
int16_t handle,
PS2000A_TRIGGER_CHANNEL_PROPERTIES * channelProperties,
int16_t nChannelProperties,
int16_t auxOutputEnable,
int32_t autoTriggerMilliseconds
)
This function is used to enable or disable triggering and set its parameters.
The structure is byte-aligned. In C++, for example, you should specify this using the
#pragma pack() instruction.
Hysteresis
Each trigger threshold (upper and lower) has an accompanying parameter called
hysteresis. This defines a second threshold at a small offset from the main threshold.
The trigger fires when the signal crosses the trigger threshold, but will not fire again
until the signal has crossed the hysteresis threshold and then returned to cross the
trigger threshold. The double-threshold mechanism prevents noise on the signal from
causing unwanted trigger events.
For a rising-edge trigger the hysteresis threshold is below the trigger threshold. After
one trigger event, the signal must fall below the hysteresis threshold before the trigger
is enabled for the next event. Conversely, for a falling-edge trigger, the hysteresis
threshold is always above the trigger threshold. After a trigger event, the signal must
rise above the hysteresis threshold before the trigger is enabled for the next event.
Hysteresis – The
trigger fires at A as
the signal rises past
the trigger threshold.
It does not fire at B
because the signal
has not yet dipped
below the hysteresis
threshold. The
trigger fires again at
C after the signal has
dipped below the
hysteresis threshold
and risen again past
the trigger threshold.
Elements thresholdUpper, the upper threshold at which the trigger fires. This
is scaled in 16-bit ADC counts at the currently selected range for that
channel.
channel, the channel to which the properties apply. This can be one
of the four input channels listed under ps2000aSetChannel, or
PS2000A_TRIGGER_EXT for the Ext input fitted to some models.
3.58 ps2000aSetTriggerDelay
PICO_STATUS ps2000aSetTriggerDelay
(
int16_t handle,
uint32_t delay
)
This function sets the post-trigger delay, which causes capture to start a defined time
after the trigger event.
delay, the time between the trigger occurring and the first sample.
For example, if delay=100 then the scope would wait 100 sample
periods before sampling. At a timebase of 1 GS/s, or 1 ns per sample,
the total delay would then be 100 x 1 ns = 100 ns.
Range: 0 to MAX_DELAY_COUNT
Returns PICO_OK
PICO_INVALID_HANDLE
PICO_USER_CALLBACK
PICO_DRIVER_FUNCTION
3.59 ps2000aSetTriggerDigitalPortProperties
PICO_STATUS ps2000aSetTriggerDigitalPortProperties
(
int16_t handle,
PS2000A_DIGITAL_CHANNEL_DIRECTIONS * directions,
int16_t nDirections
)
This function will set the individual Digital channels trigger directions. Each trigger
direction consists of a channel name and a direction. If the channel is not included in
the array of PS2000A_DIGITAL_CHANNEL_DIRECTIONS the driver assumes the digital
channel's trigger direction is PS2000A_DIGITAL_DONT_CARE.
pragma pack(1)
typedef struct tPS2000ADigitalChannelDirections
{
PS2000A_DIGITAL_CHANNEL channel;
PS2000A_DIGITAL_DIRECTION direction;
} PS2000A_DIGITAL_CHANNEL_DIRECTIONS;
#pragma pack()
The structure is byte-aligned. In C++, for example, you should specify this using the
#pragma pack() instruction.
3.60 ps2000aSigGenArbitraryMinMaxValues
PICO_STATUS ps2000aSigGenArbitraryMinMaxValues
(
int16_t handle,
int16_t * minArbitraryWaveformValue,
int16_t * maxArbitraryWaveformValue,
uint32_t * minArbitraryWaveformSize,
uint32_t * maxArbitraryWaveformSize
)
This function returns the range of possible sample values and waveform buffer sizes
that can be supplied to ps2000aSetSigGenArbitrary for setting up the arbitrary
waveform generator (AWG). These values may vary between models.
3.61 ps2000aSigGenFrequencyToPhase
PICO_STATUS ps2000aSigGenFrequencyToPhase
(
int16_t handle,
double frequency,
PS3000A_INDEX_MODE indexMode,
uint32_t bufferLength,
uint32_t * phase
)
This function converts a frequency to a phase count for use with the arbitrary
waveform generator setup functions ps2000aSetSigGenArbitrary and
ps2000aSetSigGenPropertiesArbitrary. The value returned depends on the length
of the buffer, the index mode passed and the device model.
3.62 ps2000aSigGenSoftwareControl
PICO_STATUS ps2000aSigGenSoftwareControl
(
int16_t handle,
int16_t state
)
This function causes a trigger event, or starts and stops gating. Use it as follows:
3.63 ps2000aStop
PICO_STATUS ps2000aStop
(
int16_t handle
)
This function stops the scope device from sampling data. If this function is called
before a trigger event occurs, the oscilloscope may not contain valid data.
Always call this function after the end of a capture to ensure that the scope is ready
for the next capture.
Returns PICO_OK
PICO_INVALID_HANDLE
PICO_USER_CALLBACK
PICO_DRIVER_FUNCTION
3.64 ps2000aStreamingReady
typedef void (CALLBACK *ps2000aStreamingReady)
(
int16_t handle,
int32_t noOfSamples,
uint32_t startIndex,
int16_t overflow,
uint32_t triggerAt,
int16_t triggered,
int16_t autoStop,
void * pParameter
)
This callback function is part of your application. You register it with the driver using
ps2000aGetStreamingLatestValues, and the driver calls it back when streaming-
mode data is ready. You can then download the data using the
ps2000aGetValuesAsync function.
The function should do nothing more than copy the data to another buffer within your
application. To maintain the best application performance, the function should return
as quickly as possible without attempting to process or display the data.
The source code contained in the Wrapper projects contains a description of the
functions and the input and output parameters.
Below we explain the sequence of calls required to capture data in streaming mode
using the wrapper API functions.
The ps2000aWrap.dll wrapper DLL has a callback function for streaming data
collection that copies data from the driver buffer specified to a temporary application
buffer of the same size. To do this it must be registered with the wrapper and the
channel must be specified as being enabled. You should process the data in the
temporary application buffer accordingly, for example by copying the data into a large
array.
Procedure:
1. Open the oscilloscope using ps2000aOpenUnit.
1a. Inform the wrapper of the number of channels on the device by calling
setChannelCount.
2a. Inform the wrapper which channels have been enabled by calling
setEnabledChannels.
3a. [MSOs only] Inform the wrapper which digital ports have been enabled by calling
setEnabledDigitalPorts.
4. Use the appropriate trigger setup functions. For programming languages that do not
support structures, use the wrapper's advanced trigger setup functions.
6a. Register the data buffer(s) with the wrapper and set the application buffer(s) into
which the data will be copied.
8. Loop and call GetStreamingLatestValues and IsReady to get data and flag when
the wrapper is ready for data to be retrieved.
8a. Call the wrapper’s AvailableData function to obtain information on the number of
samples collected and the start index in the buffer.
8b. Call the wrapper’s IsTriggerReady function for information on whether a trigger
has occurred and the trigger index relative to the start index in the buffer.
10. Call AutoStopped if the autoStop parameter has been set to TRUE in the call to
ps2000aRunStreaming.
11. Repeat steps 8 to 10 until AutoStopped returns true or you wish to stop data
collection.
12. Call ps2000aStop, even if the autoStop parameter was set to TRUE.
4 Further information
4.1 Programming examples
Your SDK installation includes programming examples in a selection of languages and
development environments. Please refer to the SDK for details.
5 Glossary
AC/DC control. Each channel can be set to either AC coupling or DC coupling. With
DC coupling, the voltage displayed on the screen is equal to the true voltage of the
signal. With AC coupling, any DC component of the signal is filtered out, leaving only
the variations in the signal (the AC component).
Aggregation. This is the data-reduction method used by the PicoScope 2000 Series
(A API) scopes. For each block of consecutive samples, the scope transmits only the
minimum and maximum samples over the USB port to the PC. You can set the number
of samples in each block, called the aggregation parameter, when you call
ps2000aRunStreaming for real-time capture, and when you call
ps2000aGetStreamingLatestValues to obtain post-processed data.
Analog bandwidth. All oscilloscopes have an upper limit to the range of frequencies
at which they can measure accurately. The analog bandwidth of an oscilloscope is
defined as the frequency at which a displayed sine wave has half the power of the
input sine wave (or, equivalently, about 71% of the amplitude).
Block mode. A sampling mode in which the computer prompts the oscilloscope to
collect a block of data into its internal memory before stopping the oscilloscope and
transferring the whole block into computer memory. This mode of operation is
effective when the input signal being sampled contains high frequencies. Note: To
avoid aliasing effects, the maximum input frequency must be less than half the
sampling rate.
Buffer size. The size, in samples, of the oscilloscope buffer memory. The buffer
memory is used by the oscilloscope to temporarily store data before transferring it to
the PC.
External trigger. This is the BNC socket marked EXT on the oscilloscope. It can be
used to start a data collection run but cannot be used to record data.
Maximum sampling rate. A figure indicating the maximum number of samples the
oscilloscope is capable of acquiring per second. Maximum sample rates are given in
MS/s (megasamples per second) or GS/s (gigasamples per second). The higher the
sampling capability of the oscilloscope, the more accurate the representation of the
high frequencies in a fast signal.
MSO (mixed-signal oscilloscope). An oscilloscope that has both analog and digital
inputs.
Overvoltage. Any input voltage to the oscilloscope must not exceed the overvoltage
limit, measured with respect to ground, otherwise the oscilloscope may be
permanently damaged.
Streaming mode. A sampling mode in which the oscilloscope samples data and
returns it to the computer in an unbroken stream. This mode of operation is effective
when the input signal being sampled contains only low frequencies.
Timebase. The timebase controls the time interval across the scope display. There are
ten divisions across the screen and the timebase is specified in units of time per
division, so the total time interval is ten times the timebase.
USB 1.1. An early version of the Universal Serial Bus standard found on older PCs.
Although your PicoScope will work with a USB 1.1 port, it will operate much more
slowly than with a USB 2.0 or 3.0 port.
USB 2.0. Universal Serial Bus (High Speed). A standard port used to connect external
devices to PCs. The high-speed data connection provided by a USB 2.0 port enables
your PicoScope to achieve its maximum performance.
USB 3.0. A faster version of the Universal Serial Bus standard. Your PicoScope is fully
compatible with USB 3.0 ports and will operate with the same performance as on a
USB 2.0 port.
Vertical resolution. A value, in bits, indicating the degree of precision with which the
oscilloscope can turn input voltages into digital values. Calculation techniques can
improve the effective resolution.
Voltage range. The voltage range is the difference between the maximum and
minimum voltages that can be accurately captured by the oscilloscope.
callback 24
polling status 52 F
running 62
Fitness for purpose 3
Buffer size 106
Functions
list of 22
C ps2000aBlockReady 24
ps2000aCloseUnit 25
Callback 7, 15
ps2000aDataReady 26
block mode 24
ps2000aEnumerateUnits 27
for data 26
streaming mode 102 ps2000aFlashLed 28
ps2000aGetAnalogueOffset 29
Channels
ps2000aGetChannelInformation 30
enabling 66
ps2000aGetMaxDownSampleRatio 31
settings 66
ps2000aGetMaxSegments 32
Closing units 25
ps2000aGetNoOfCaptures 33, 34
Common-mode voltage 106
ps2000aGetStreamingLatestValues 35
Communication 61
ps2000aGetTimebase 20, 36
Connection 61
ps2000aGetTimebase2 37
Constants 105
ps2000aGetTriggerTimeOffset 38
Copyright 3
ps2000aGetTriggerTimeOffset64 39
Coupling 106
ps2000aGetUnitInfo 40
Coupling type, setting 66
ps2000aGetValues 9, 41
ps2000aGetValuesAsync 9, 43
D ps2000aGetValuesBulk 44
Data acquisition 17 ps2000aGetValuesOverlapped 45
Data buffers ps2000aGetValuesOverlappedBulk 47
declaring 67 ps2000aGetValuesTriggerTimeOffsetBulk 48
declaring, aggregation mode 68 ps2000aGetValuesTriggerTimeOffsetBulk64
Data retention 8 50, 51
ps2000aIsReady 52
deltaPhase argument (AWG) 82
ps2000aIsTriggerOrPulseWidthQualifierEnabled
Digital inputs
53
connector 21
ps2000aMaximumValue 5, 54
data format 6
ps2000aMemorySegments 55
Functions Liability 3
ps2000aMinimumValue 5, 56
ps2000aNoOfStreamingValues
ps2000aOpenUnit 58
57
M
ps2000aOpenUnitAsync 59 Memory buffer 8
ps2000aOpenUnitProgress 60 Memory segmentation 8, 9, 17, 55
ps2000aPingUnit 61 Mission-critical applications 3
ps2000aRunBlock 62 Multi-unit operation 21
ps2000aRunStreaming 64
ps2000aSetChannel 5, 66 N
ps2000aSetDataBuffer 67
Numeric data types 105
ps2000aSetDataBuffers 68
ps2000aSetDigitalAnalogTriggerOperand 69
ps2000aSetEts 15, 71 O
ps2000aSetEtsTimeBuffer 72 One-shot signals 15
ps2000aSetEtsTimeBuffers 73 Opening a unit 58
ps2000aSetNoOfCaptures 74 checking progress 60
ps2000aSetPulseWidthDigitalPortProperties without blocking 59
75 Oversampling 42
ps2000aSetPulseWidthQualifier 76
ps2000aSetSigGenArbitrary 79
ps2000aSetSigGenBuiltIn 83
P
ps2000aSetSigGenPropertiesArbitrary 86 PC Oscilloscope 1, 106
ps2000aSetSigGenPropertiesBuiltIn 87 PC requirements 2
ps2000aSetSimpleTrigger 6, 88 PICO_STATUS enum type 105
ps2000aSetTriggerChannelConditions 6, 89 PicoScope 2000 Series 1
ps2000aSetTriggerChannelDirections 6, 91 PicoScope software 1, 4, 105, 106
ps2000aSetTriggerChannelProperties 6, 92 Programming
ps2000aSetTriggerDelay 95 general procedure 4
ps2000aSetTriggerDigitalPortProperties 96 ps2000a.dll 4
ps2000aSigGenSoftwareControl 100 PS2000A_CONDITION_ constants 78, 90
ps2000aStop 9, 101 PS2000A_LEVEL constant 93, 97
ps2000aStreamingReady 102 PS2000A_PWQ_CONDITIONS structure 78
ps2000SetSigGenBuiltInV2 85 PS2000A_RATIO_MODE_AGGREGATE 42
PS2000A_RATIO_MODE_AVERAGE 42
H PS2000A_RATIO_MODE_DECIMATE 42
PS2000A_TIME_UNITS constant 38, 39
Hysteresis 93, 97 PS2000A_TRIGGER_CHANNEL_PROPERTIES
structure 93, 97
I PS2000A_TRIGGER_CONDITIONS 89
PS2000A_TRIGGER_CONDITIONS structure 90
Index modes PS2000A_WINDOW constant 93, 97
dual 81
ps2000aSigGenArbitraryMinMaxValues 98
single 81
ps2000aSigGenFrequencyToPhase 99
Information, reading from units 40
Pulse-width qualifier 76
Input range, selecting 66 conditions 78
Intended use 1 requesting status 53
L R
LED
Ranges 30
flashing 28
Rapid block mode 7, 10, 10, 33, 34
Legal information 3 aggregation 13
S V
Viruses 3
Sampling rate 106
maximum 8 Voltage range 5, 106
selecting 66
Scaling 5
Serial numbers 27
Setup time 8 W
Signal generator
WinUsb.sys 4
arbitrary waveforms 79
Wrapper functions 103
built-in waveforms 83, 85
software trigger 100
Status codes 105
Stopping sampling 101
Streaming mode 7, 17, 106
callback 102
getting number of samples 57
retrieving data 35
running 64
using 18
Support 3
T
Time buffers
setting for ETS 72, 73
Timebase 20, 106
calculating 36, 37
Trademarks 3
Trigger
channel properties 75, 92, 96
combining analog and digital 69
conditions 89, 90
delay 95
digital port pulse width 75
digital ports 96
directions 91
external 5
pulse-width qualifier 76
pulse-width qualifier conditions 78
Tel: +44 (0) 1480 396 395 Tel: +1 800 591 2796
Fax: +44 (0) 1480 396 296 Fax: +1 620 272 0981
[email protected]
[email protected]
www.picotech.com
ps2000apg.en r9 2016-03-09
Copyright © 2011–2016 Pico Technology Ltd. All rights reserved.