Picoscope 2000 Series Programmers Guide
Picoscope 2000 Series Programmers Guide
PC Oscilloscopes
Programmer's Guide
ps2000pg.en-12
PicoScope 2000 Series Programmer's Guide Contents
Contents
1 Introduction ............................................................................................................... 5
1 Overview ............................................................................................................................................. 5
2 Minimum system requirements ........................................................................................................ 5
3 Legal information ............................................................................................................................... 6
4 Trademarks ........................................................................................................................................ 7
5 Warranty .............................................................................................................................................. 7
16 ps2000_ready .................................................................................................................................. 36
17 ps2000_run_block .......................................................................................................................... 37
18 ps2000_run_streaming ................................................................................................................... 38
19 ps2000_run_streaming_ns ............................................................................................................. 39
20 ps2000SetAdvTriggerChannelConditions ..................................................................................... 40
1 PS2000_TRIGGER_CONDITIONS structure .......................................................................... 41
21 ps2000SetAdvTriggerChannelDirections ...................................................................................... 42
22 ps2000SetAdvTriggerChannelProperties ...................................................................................... 43
1 PS2000_TRIGGER_CHANNEL_PROPERTIES structure ....................................................... 44
23 ps2000SetAdvTriggerDelay ............................................................................................................ 45
24 ps2000_set_channel ....................................................................................................................... 46
25 ps2000_set_ets .............................................................................................................................. 47
26 ps2000_set_light ............................................................................................................................ 48
27 ps2000_set_led ............................................................................................................................... 49
28 ps2000SetPulseWidthQualifier ...................................................................................................... 50
1 PS2000_PWQ_CONDITIONS structure ................................................................................. 51
29 ps2000_set_sig_gen_arbitrary ....................................................................................................... 52
30 ps2000_set_sig_gen_built_in ......................................................................................................... 54
31 ps2000_set_trigger ......................................................................................................................... 56
32 ps2000_set_trigger2 ....................................................................................................................... 57
33 ps2000_stop ................................................................................................................................... 58
34 my_get_overview_buffers .............................................................................................................. 59
1 Introduction
1.1 Overview
The PicoScope 2000 Series PC Oscilloscopes are low-cost, high-performance instruments that
are fully USB 2.0-capable and also backwards-compatible with USB 1.1. There is no need for
an additional power supply, as power is taken from the USB port.
This manual explains how to develop your own programs for collecting and analyzing data
from the PicoScope 2000 Series oscilloscopes. This manual describes the application
programming interface (API) for the devices shown below.
The Pico Technology software development kit (SDK) is available on the Pico Technology
Software and Reference CD-ROM and for free download from www.picotech.com/downloads.
Please note the PicoScope software is not installed as part of the SDK.
Item Specification
Operating Windows 7, Windows 8, Windows 10
system 32 bit and 64 bit versions supported
Processor
Memory As required by the operating system
Free disk space
Ports USB 1.1 compliant port (absolute minimum)*
USB 2.0 or USB 3.0 compliant port
* The oscilloscope will run slowly on a USB 1.1 port. This configuration is not recommended.
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 Technology products or with data
collected using Pico Technology 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.
Mission-critical applications. This software is intended for use on a computer that may be
running other software products. For this reason, one of the conditions of the license is that it
excludes use in mission-critical applications, for example life support systems.
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.
Upgrades. We provide upgrades, free of charge, from our web site at www.picotech.com. We
reserve the right to charge for updates or replacements sent out on physical media.
1.4 Trademarks
Pico Technology Limited and PicoScope are trademarks of Pico Technology Limited,
registered in the United Kingdom and other countries.
PicoScope and Pico Technology are registered in the U.S. Patent and Trademark Office.
Windows is a registered trademark of Microsoft Corporation in the USA and other countries.
1.5 Warranty
Pico Technology warrants upon delivery, and for a period of 5 years unless otherwise stated
from the date of delivery, that the Goods will be free from defects in material and
workmanship.
Pico Technology shall not be liable for a breach of the warranty if the defect has been caused
by fair wear and tear, willful damage, negligence, abnormal working conditions or failure to
follow Pico Technology's spoken or written advice on the storage, installation, commissioning,
use or maintenance of the Goods or (if no advice has been given) good trade practice; or if
the Customer alters or repairs such Goods without the written consent of Pico Technology.
Numerous sample programs are included in the SDK. These show how to use the functions of
the driver software in each of the modes available.
2.2 Driver
Your application will communicate with a PicoScope 2000 API driver called ps2000.dll, which
is supplied in 32-bit and 64-bit versions. The driver exports the ps2000 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 a low-level driver called WinUsb.sys (supplied in 32-bit and 64-bit
versions), which is installed by the SDK and configured when you plug the oscilloscope into
each USB port for the first time. Your application does not call this driver directly.
The driver scales all readings to 16 bits, regardless of the voltage range the oscilloscope is set
to. The following table shows the relationship between the reading from the driver and the
signal level.
Example
1. Call
ps2000_set_channel
with range set to
PS2000_1V.
2.4 Triggering
PicoScope 2000 Series PC Oscilloscopes can either start collecting data immediately, or be
programmed to wait for a trigger event to occur. In both cases you need to use the
ps2000_set_trigger function or, for scopes that support advanced triggering, the
ps2000SetAdvTriggerChannelConditions and related functions. A trigger event can
occur on any of the conditions available in the simple and advanced triggering modes.
Applicability Available in block mode and fast streaming mode only. Calls to the
ps2000_set_trigger and
ps2000SetAdvTriggerChannelConditions functions have no effect in
compatible streaming mode.
The triggering methods available for your oscilloscope are listed in the data sheet. Where
available, the pulse width, delay and drop-out triggering methods additionally require the use of
the pulse width qualifier function, ps2000SetPulseWidthQualifier.
2.7 Oversampling
When the oscilloscope is operating at sampling rates less than the maximum, it is possible to
oversample. Oversampling is taking more than one measurement during a time interval and
returning an average. If the signal contains a small amount of noise, this technique can
increase the effective vertical resolution of the oscilloscope by the amount given by the
equation below:
3 Sampling modes
PicoScope 2000 Series PC Oscilloscopes can run in various sampling modes.
Block mode. At the highest sampling rates, the oscilloscope collects data much faster than
a PC can read it. In this case, the oscilloscope stores a block of data in an internal memory
buffer, delaying transfer to the PC until the required number of data points have been
sampled.
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.
Streaming modes. At all but the highest sampling rates, these modes allow accurately
timed data to be transferred back to the PC without gaps. The computer instructs the
oscilloscope to start collecting data. The oscilloscope then transfers data back to the PC
without storing it in its own memory, so the size of the data set is limited only by the size
of the PC's memory. Sampling intervals from less than one microsecond (depending on
model) to 60 seconds are possible. There are two streaming modes:
The maximum number of values depends upon the size of the oscilloscope's memory. A
PicoScope 2000 Series oscilloscope can sample at a number of different rates that correspond
to the maximum sampling rate divided by 1, 2, 4, 8 and so on.
There is a separate memory buffer for each channel. When a channel is unused, its memory
can be borrowed by the enabled channels. This feature is handled transparently by the driver.
The driver normally performs a number of setup operations before collecting each block of
data. This can take up to 50 milliseconds. If it is necessary to collect data with the minimum
time interval between blocks, avoid calling setup functions between calls to
ps2000_run_block, ps2000_ready, ps2000_stop and ps2000_get_values.
In streaming mode, the computer prompts the oscilloscope to start collecting data. The data is
then transferred back to the PC without being stored in the oscilloscope's memory. Data can
be sampled with a period between 1 µs or less and 60 s, and the maximum number of
samples is limited only by the amount of free space on the PC's hard disk.
The oscilloscope's driver transfers data to a computer program using either normal or
windowed mode. In normal mode, any data collected since the last data transfer operation is
returned in its entirety. Normal mode is useful if the computer program requires fresh data on
every transfer. In windowed mode, a fixed number of samples is returned, where the oldest
samples may have already been returned before. Windowed mode is useful when the program
requires a constant time period of data.
Once the oscilloscope is collecting data in compatible streaming mode, any setup changes (for
example, changing a channel range or AC/DC setting) will cause a restart of the data stream.
The driver can buffer up to 32 kilosamples of data per channel, but the user must ensure that
the ps2000_get_values function is called frequently enough to avoid buffer overrun.
For streaming with the PicoScope 2202, 2203, 2204, 2204A, 2205 and 2205A variants, we
recommend you use fast streaming mode instead.
Applicability Only recommended for use with PicoScope 2104 and 2105.
Fast streaming mode also provides data aggregation, which allows your application to zoom in
and out of the data with the minimum of effort.
Applicability PicoScope 2202, 2203, 2204, 2204A, 2205 and 2205A only.
ETS works by capturing many instances of a repetitive waveform, then combining them to
produce a composite waveform that has a higher effective sampling rate than the individual
instances. The maximum effective sampling rates that can be achieved with this method are
listed in the data sheet specifications for your oscilloscope.
Because of the high sensitivity of ETS mode to small time differences, you must set up the
trigger to provide a stable waveform that varies as little as possible from one capture to the
next.
To begin, call ps2000_open_unit to obtain a handle for each oscilloscope. All the other
functions require this handle for oscilloscope identification. For example, to collect data from
two oscilloscopes at the same time:
handle1 = ps2000_open_unit()
handle2 = ps2000_open_unit()
ps2000_set_channel(handle1)
... set up unit 1
ps2000_run_block(handle1)
ps2000_set_channel(handle2)
... set up unit 2
ps2000_run_block(handle2)
ready = FALSE
while not ready
ready = ps2000_ready(handle1)
ready &= ps2000_ready(handle2)
ps2000_get_values(handle1)
ps2000_get_values(handle2)
ps2000_close_unit(handle1)
ps2000_close_unit(handle2)
It is not possible to synchronize the collection of data between oscilloscopes that are being
used in combination.
5 API Functions
The PicoScope 2000 Series API exports the following functions for you to use in your own
applications:
ps2000_close_unit
ps2000_flash_led
ps2000_get_streaming_last_values
ps2000_get_streaming_values
ps2000_get_streaming_values_no_aggregation
ps2000_get_timebase
ps2000_get_times_and_values
ps2000_get_unit_info
ps2000_get_values
ps2000_last_button_press
ps2000_open_unit
ps2000_open_unit_async
ps2000_open_unit_progress
ps2000_overview_buffer_status
ps2000PingUnit
ps2000_ready
ps2000_run_block
ps2000_run_streaming
ps2000_run_streaming_ns
ps2000SetAdvTriggerChannelConditions
ps2000SetAdvTriggerChannelDirections
ps2000SetAdvTriggerChannelProperties
ps2000SetAdvTriggerDelay
ps2000_set_channel
ps2000_set_ets
ps2000_set_led
ps2000_set_light
ps2000SetPulseWidthQualifier
ps2000_set_sig_gen_arbitrary
ps2000_set_sig_gen_built_in
ps2000_set_trigger
ps2000_set_trigger2
ps2000_stop
my_get_overview_buffers
5.1 ps2000_close_unit
int16_t ps2000_close_unit
(
int16_t handle
)
5.2 ps2000_flash_led
int16_t ps2000_flash_led
(
int16_t handle
)
Flashes the LED on the front of the oscilloscope (or in the pushbutton, for the PicoScope 2104
and 2105 oscilloscopes) three times and returns within one second.
0: if handle is invalid
5.3 ps2000_get_streaming_last_values
int16_t ps2000_get_streaming_last_values
(
int16_t handle
GetOverviewBuffersMaxMin lpGetOverviewBuffersMaxMin
)
This function is used to collect the next block of values while fast streaming is running. You
must call ps2000_run_streaming_ns beforehand to set up fast streaming.
Not compatible with ETS triggering. Function has no effect in ETS mode.
Arguments handle: the handle of the required oscilloscope
0: if the callback will not be called, either because one of the inputs is out of
range or because there are no samples available
5.4 ps2000_get_streaming_values
uint32_t ps2000_get_streaming_values
(
int16_t handle,
double *start_time,
int16_t *pbuffer_a_max,
int16_t *pbuffer_a_min,
int16_t *pbuffer_b_max,
int16_t *pbuffer_b_min,
int16_t *pbuffer_c_max,
int16_t *pbuffer_c_min,
int16_t *pbuffer_d_max,
int16_t *pbuffer_d_min,
int16_t *overflow,
uint32_t *triggerAt,
int16_t *triggered,
uint32_t no_of_values,
uint32_t noOfSamplesPerAggregate
)
This function is used after the driver has finished collecting data in fast streaming mode. It
allows you to retrieve data with different aggregation ratios, and thus zoom in to and out of
any region of the data.
Before calling this function, first capture some data in fast streaming mode, stop fast
streaming by calling ps2000_stop, then allocate sufficient buffer space to receive the
requested data. The function will store the data in your buffer with values in the range
PS2000_MIN_VALUE to PS2000_MAX_VALUE. The special value PS2000_LOST_DATA is
stored in the buffer when data could not be collected because of a buffer overrun. (See
Voltage ranges for more on data values.)
Each sample of aggregated data is created by processing a block of raw samples. The
aggregated sample is stored as a pair of values: the minimum and the maximum values of the
block.
Not compatible with ETS triggering - function has no effect in ETS mode
Arguments handle: the handle of the required oscilloscope
overflow: on exit, the function writes a bit field here indicating whether the
voltage on each of the input channels has overflowed:
Bit 0: Ch A overflow
Bit 1: Ch B overflow
triggerAt: on exit, the function writes an index value here. This is the
offset, from the start of the buffer, of the sample at the trigger reference
point. It is valid only when triggered is TRUE.
5.5 ps2000_get_streaming_values_no_aggregation
uint32_t ps2000_get_streaming_values_no_aggregation
(
int16_t handle,
double *start_time,
int16_t *pbuffer_a,
int16_t *pbuffer_b,
int16_t *pbuffer_c,
int16_t *pbuffer_d,
int16_t *overflow,
uint32_t *triggerAt,
int16_t *trigger,
uint32_t no_of_values
)
This function retrieves raw streaming data from the driver's data store after fast streaming
has stopped.
Before calling the function, capture some data using fast streaming, stop streaming using
ps2000_stop, and then allocate sufficient buffer space to receive the requested data. The
function will store the data in your buffer with values in the range PS2000_MIN_VALUE to
PS2000_MAX_VALUE. The special value PS2000_LOST_DATA is stored in the buffer when data
could not be collected because of a buffer overrun. (See Voltage ranges for more details of
data values.)
overflow: on exit, the function will write a bit field here indicating whether
the voltage on each of the input channels has overflowed. Bit 0 is the LSB.
The bit assignments are as follows:
Bit 0 - Ch A overflow
Bit 1 - Ch B overflow
triggerAt: on exit, the function writes an index into the buffers here. The
index is the number of the sample at the trigger reference point. It is valid
only when trigger is TRUE.
5.6 ps2000_get_timebase
int16_t ps2000_get_timebase
(
int16_t handle,
int16_t timebase,
int32_t no_of_samples,
int32_t *time_interval,
int16_t *time_units,
int16_t oversample,
int32_t *max_samples
)
This function discovers which timebases are available on the oscilloscope. You should set up
the channels using ps2000_set_channel and, if required, ETS mode using
ps2000_set_ets first. Then call this function with increasing values of timebase, starting
from 0, until you find a timebase with a sampling interval and sample count close enough to
your requirements.
0: on error
5.7 ps2000_get_times_and_values
int32_t ps2000_get_times_and_values
(
int16_t handle
int32_t *times,
int16_t *buffer_a,
int16_t *buffer_b,
int16_t *buffer_c,
int16_t *buffer_d,
int16_t *overflow,
int16_t time_units,
int32_t no_of_values
)
This function is used to get values and times in block mode after calling ps2000_run_block.
Note that if you are using block mode or ETS mode and call this function before the
oscilloscope is ready, no capture will be available and the driver will not return any samples.
Applicability Block mode only. It will not return any valid times if the oscilloscope is in
streaming mode.
0: if one or more of the parameters are out of range, if the times will
overflow with the time_units requested (use ps2000_get_timebase to
acquire the most suitable time_units) or if the oscilloscope is in streaming
mode
5.8 ps2000_get_unit_info
int16_t ps2000_get_unit_info
(
int16_t handle,
int8_t *string,
int16_t string_length,
int16_t line
)
This function writes oscilloscope information to a character string. If the oscilloscope failed to
open, only line types 0 and 6 are available to explain why the last open unit call failed.
string: a pointer to the character string buffer in the calling function where
the function will write the oscilloscope information string selected with line.
If string is NULL, no information will be written.
5.9 ps2000_get_values
int32_t ps2000_get_values
(
int16_t handle
int16_t *buffer_a,
int16_t *buffer_b,
int16_t *buffer_c,
int16_t *buffer_d,
int16_t *overflow,
int32_t no_of_values
)
This function is used to get values in compatible streaming mode after calling
ps2000_run_streaming, or in block mode after calling ps2000_run_block.
Note that if you are using block mode or ETS mode and call this function before the
oscilloscope is ready, no capture will be available and the driver will not return any samples.
buffer_a, buffer_b: pointers to the buffers that receive data from the
specified channels (A and B). A pointer is not used if the oscilloscope is not
collecting data from that channel. If a pointer is NULL, nothing will be written
to it.
5.10 ps2000_last_button_press
int16_t ps2000_last_button_press
(
int16_t handle
)
This function returns the last registered state of the pushbutton on the PicoScope 2104 or
2105 PC Oscilloscope and then resets the status to zero.
5.11 ps2000_open_unit
int16_t ps2000_open_unit
(
void
)
This function opens a PicoScope 2000 Series oscilloscope. The driver can support up to 64
oscilloscopes.
0: if no oscilloscope is found
>0 (oscilloscope handle): if the oscilloscope opened. Use this as the handle
argument for all subsequent API calls for this oscilloscope.
5.12 ps2000_open_unit_async
int16_t ps2000_open_unit_async
(
void
)
This function opens a PicoScope 2000 Series oscilloscope without waiting for the operation to
finish. You can find out when it has finished by periodically calling
ps2000_open_unit_progress until that function returns a non-zero value and a valid
oscilloscope handle.
5.13 ps2000_open_unit_progress
int16_t ps2000_open_unit_progress
(
int16_t *handle,
int16_t *progress_percent
)
5.14 ps2000_overview_buffer_status
int16_t ps2000_overview_buffer_status
(
int16_t handle,
int16_t *previous_buffer_overrun
)
Not compatible with ETS triggering - function has no effect in ETS mode
Arguments handle: the handle of the required oscilloscope
5.15 ps2000PingUnit
int16_t ps2000PingUnit
(
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.
5.16 ps2000_ready
int16_t ps2000_ready
(
int16_t handle
)
This function polls the driver to see if the oscilloscope has finished the last data collection
operation.
Applicability Block mode only. Does nothing if the oscilloscope is in streaming mode.
Arguments handle: the handle of the required oscilloscope
Returns >0: if ready. The oscilloscope has collected a complete block of data or the
auto trigger timeout has been reached.
-1: if the oscilloscope is not attached. The USB transfer failed, indicating that
the oscilloscope may have been unplugged.
5.17 ps2000_run_block
int16_t ps2000_run_block
(
int16_t handle,
int32_t no_of_samples,
int16_t timebase,
int16_t oversample,
int32_t *time_indisposed_ms
)
This function tells the oscilloscope to start collecting data in block mode.
non-zero: if successful
5.18 ps2000_run_streaming
int16_t ps2000_run_streaming
(
int16_t handle,
int16_t sample_interval_ms,
int32_t max_samples,
int16_t windowed
)
This function tells the oscilloscope to start collecting data in compatible streaming mode. If this
function is called when a trigger has been enabled, the trigger settings will be ignored.
For streaming with the PicoScope 2202, 2203, 2204, 2204A, 2205 and 2205A variants, we
recommend you use ps2000_run_streaming_ns instead: this will allow much faster data
transfer.
Applicability Only recommended for use with PicoScope 2104 and 2105
Arguments handle: the handle of the required oscilloscope
windowed: if this is 0, only the values taken since the last call to
ps2000_get_values are returned. If this is 1, the number of values
requested by ps2000_get_values are returned, even if they have already
been read by ps2000_get_values.
Returns non-zero: if streaming has been enabled correctly
5.19 ps2000_run_streaming_ns
int16_t ps2000_run_streaming_ns
(
int16_t handle,
uint32_t sample_interval,
PS2000_TIME_UNITS time_units,
uint32_t max_samples,
int16_t auto_stop,
uint32_t noOfSamplesPerAggregate,
uint32_t overview_buffer_size
)
This function tells the oscilloscope to start collecting data in fast streaming mode. It returns
immediately without waiting for data to be captured. After calling it, you should next call
ps2000_get_streaming_last_values to copy the data to your application's buffer.
Applicability PicoScope 2202, 2203, 2204, 2204A, 2205 and 2205A only
Arguments handle: the handle of the required oscilloscope
5.20 ps2000SetAdvTriggerChannelConditions
int16_t ps2000SetAdvTriggerChannelConditions
(
int16_t handle,
PS2000_TRIGGER_CONDITIONS *conditions,
int16_t nConditions
)
This function sets up trigger conditions on the scope's inputs. The trigger is defined by a
PS2000_TRIGGER_CONDITIONS structure.
non-zero: if successful
Remarks
The channels that are set to CONDITION_TRUE or CONDITION_FALSE must all meet their
conditions simultaneously to produce a trigger. Channels set to CONDITION_DONT_CARE are
ignored.
The PicoScope 2202 oscilloscope can use only a single input channel (either channel A or
channel B) for the trigger source. Therefore you may define CONDITION_TRUE or
CONDITION_FALSE for only one of these channels at a time. You can, optionally, set up the
pulse width qualifier in combination with one of the input channels.
The PicoScope 2204, 2204A, 2205 and 2205A models can all trigger from both channel A and
channel B, and therefore all support logic triggering.
5.21 ps2000SetAdvTriggerChannelDirections
int16_t ps2000SetAdvTriggerChannelDirections
(
int16_t handle,
PS2000_THRESHOLD_DIRECTION channelA,
PS2000_THRESHOLD_DIRECTION channelB,
PS2000_THRESHOLD_DIRECTION channelC,
PS2000_THRESHOLD_DIRECTION channelD,
PS2000_THRESHOLD_DIRECTION ext
)
This function sets the direction of the trigger for each channel.
channelA, channelB: specify the direction in which the signal must pass
through the threshold to activate the trigger. The allowable values for a
PS2000_THRESHOLD_DIRECTION variable are listed in the table below.
non-zero: if successful
PS2000_THRESHOLD_DIRECTION constants
PS2000_ABOVE for gated triggers: above a threshold
PS2000_BELOW for gated triggers: below a threshold
PS2000_ADV_RISING for threshold triggers: rising edge
PS2000_ADV_FALLING for threshold triggers: falling edge
PS2000_RISING_OR_FALLING for threshold triggers: either edge
PS2000_INSIDE for window-qualified triggers: inside window
PS2000_OUTSIDE for window-qualified triggers: outside window
PS2000_ENTER for window triggers: entering the window
PS2000_EXIT for window triggers: leaving the window
PS2000_ENTER_OR_EXIT for window triggers: either entering or leaving the window
PS2000_ADV_NONE no trigger
5.22 ps2000SetAdvTriggerChannelProperties
int16_t ps2000SetAdvTriggerChannelProperties
(
int16_t handle,
PS2000_TRIGGER_CHANNEL_PROPERTIES *channelProperties,
int16_t nChannelProperties,
int32_t autoTriggerMilliseconds
)
This function is used to enable or disable triggering and set its parameters.
channelProperties: a pointer to a
PS2000_TRIGGER_CHANNEL_PROPERTIES structure describing the
requested properties. If NULL, triggering is switched off.
non-zero: if successful
hysteresis: the hysteresis that the trigger has to exceed before it will fire.
It is scaled in 16-bit counts.
5.23 ps2000SetAdvTriggerDelay
int16_t ps2000SetAdvTriggerDelay
(
int16_t handle,
uint32_t delay,
float preTriggerDelay
)
This function sets the pre-trigger and post-trigger delays. The default action, when both these
delays are zero, is to start capturing data beginning with the trigger event and to stop a
specified time later. The start of capture can be delayed by using a non-zero value of delay.
Alternatively, the start of capture can be advanced to a time before the trigger event by using
a negative value of preTriggerDelay. If both arguments are non-zero then their effects
are added together.
delay: the post-trigger delay, measured in sample periods. This is the time
between the trigger event and the sample at time t = 0. For example, at a
timebase of 50 MS/s, or 20 ns per sample, and with delay = 100, the
post-trigger delay would be 100 20 ns = 2 µ s.
Range: [0, 2 32 –1]
non-zero: if successful
Example 1: Example 2:
delay = 0, delay = 1 ms,
preTriggerDelay = –50% preTriggerDelay = –50%
5.24 ps2000_set_channel
int16_t ps2000_set_channel
(
int16_t handle,
int16_t channel,
int16_t enabled,
int16_t dc,
int16_t range
)
Specifies if a channel is to be enabled, the AC/DC coupling mode and the input range.
range: a code between 1 and 10. See the table below, but note that each
oscilloscope variant supports only a subset of these ranges.
Returns 0: if unsuccessful, or if one or more of the arguments are out of range
non-zero: if successful
5.25 ps2000_set_ets
int32_t ps2000_set_ets
(
int16_t handle,
int16_t mode,
int16_t ets_cycles,
int16_t ets_interleave
)
This function is used to enable or disable ETS mode and to set the ETS parameters.
mode:
PS2000_ETS_OFF (0) - disables ETS
ets_cycles: the number of cycles to store. The computer can then select
ets_interleave cycles to give the most uniform spread of samples.
ets_cycles should be between two and five times the value of
ets_interleave.
5.26 ps2000_set_light
int16_t ps2000_set_light
(
int16_t handle,
int16_t state
)
This function controls the white light that illuminates the probe tip on a handheld oscilloscope.
state:
0: light off
1: light on
Returns 0: the function failed, for example if a PicoScope 2000 Series oscilloscope
was not found
non-zero: success
5.27 ps2000_set_led
int16_t ps2000_set_led
(
int16_t handle,
int16_t state
)
This function turns the LED on the oscilloscope on and off, and controls its color.
state:
3: off
1: red
2: green
Returns 0: the function failed, for example if a PicoScope 2000 Series oscilloscope
was not found
non-zero: success
5.28 ps2000SetPulseWidthQualifier
int16_t ps2000SetPulseWidthQualifier
(
int16_t handle,
PS2000_PWQ_CONDITIONS *conditions,
int16_t nConditions,
PS2000_THRESHOLD_DIRECTION direction,
uint32_t lower,
uint32_t upper,
PS2000_PULSE_WIDTH_TYPE type
)
This function sets up pulse width qualification, which can be used on its own for pulse width
triggering or combined with other triggering to produce more complex triggers. The pulse
width qualifier is set by defining a conditions structure.
upper: the upper limit of the pulse width counter. This parameter is used
only when the type is set to PW_TYPE_IN_RANGE or
PW_TYPE_OUT_OF_RANGE.
non-zero: if successful
5.29 ps2000_set_sig_gen_arbitrary
int16_t ps2000_set_sig_gen_arbitrary
(
int16_t handle,
int32_t offsetVoltage,
uint32_t pkToPk,
uint32_t startDeltaPhase,
uint32_t stopDeltaPhase,
uint32_t deltaPhaseIncrement,
uint32_t dwellCount,
uint8_t *arbitraryWaveform,
int32_t arbitraryWaveformSize,
PS2000_SWEEP_TYPE sweepType,
uint32_t sweeps
)
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.
The generator steps through the waveform by adding a deltaPhase value between 1 and
phaseAccumulatorSize-1 to the phase accumulator every ddsPeriod (1 / ddsFrequency). If the
deltaPhase is constant, the generator produces a waveform at a constant frequency that can
be calculated as follows:
deltaPhase awgBufferSize
outputFrequency = ddsFrequency × ( phaseAccumulatorSize ) × ( arbitraryWaveformSize )
where:
Parameter Value
phaseAccumulatorSize 2 32
awgBufferSize 4096
ddsFrequency 48 MHz
ddsPeriod (= 1/ddsFrequency) 20.833 ns (= 1/48 MHz)
It is also possible to sweep the frequency by continually modifying the deltaPhase. This is done
by setting up a deltaPhaseIncrement that the oscilloscope adds to the deltaPhase at
intervals specified by dwellCount.
Applicability All modes. PicoScope 2203, 2204, 2204A, 2205 and 2205A only
Arguments
handle: the handle of the required oscilloscope
startDeltaPhase: the initial value added to the phase counter as the generator begins to
step through the waveform buffer
stopDeltaPhase: the final value added to the phase counter before the generator restarts
or reverses the sweep
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.
sweeps: the number of times to sweep the frequency after a trigger event, according to
sweepType.
Returns 0: if one of the parameters is out of range
non-zero: if successful
5.30 ps2000_set_sig_gen_built_in
int16_t ps2000_set_sig_gen_built_in
(
int16_t handle,
int32_t offsetVoltage,
uint32_t pkToPk,
PS2000_WAVE_TYPE waveType,
float startFrequency,
float stopFrequency,
float increment,
float dwellTime,
PS2000_SWEEP_TYPE sweepType,
uint32_t sweeps
)
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 oscilloscope will sweep either up, down
or up and down.
waveType: the type of waveform to be generated by the oscilloscope. See the table below.
startFrequency: the frequency at which the signal generator should begin. For allowable
values see ps2000.h.
stopFrequency: the frequency at which the sweep should reverse direction or return to the
start frequency
increment: the amount by which the frequency rises or falls every dwellTime seconds in
sweep mode
non-zero: if successful
waveType values
PS2000_SINE sine wave
PS2000_SQUARE square wave
PS2000_TRIANGLE triangle wave
PS2000_RAMPUP rising sawtooth
PS2000_RAMPDOWN falling sawtooth
PS2000_DC_VOLTAGE DC voltage
PS2000_GAUSSIAN Gaussian
PS2000_SINC sin(x)/x
PS2000_HALF_SINE half (full-wave rectified) sine
5.31 ps2000_set_trigger
int16_t ps2000_set_trigger
(
int16_t handle,
int16_t source,
int16_t threshold,
int16_t direction,
int16_t delay,
int16_t auto_trigger_ms
)
This function simplifies arming the trigger. It supports only the LEVEL trigger types on analog
channels, and does not allow more than one channel to have a trigger applied to it. Any
previous pulse width qualifier is canceled. The trigger threshold includes a small, fixed amount
of hysteresis.
threshold: the threshold for the trigger event. This is scaled in 16-bit ADC
counts at the currently selected range.
non-zero: if successful
5.32 ps2000_set_trigger2
int16_t ps2000_set_trigger2
(
int16_t handle,
int16_t source,
int16_t threshold,
int16_t direction,
float delay,
int16_t auto_trigger_ms
)
This function is used to enable or disable triggering and set its parameters. It has the same
behavior as ps2000_set_trigger, except that the delay parameter is a floating-point
value.
Applicability Triggering is available in block mode and fast streaming mode only
Arguments handle: the handle of the required oscilloscope
threshold: the threshold for the trigger event. This is scaled in 16-bit ADC
counts at the currently selected range.
non-zero: if successful
5.33 ps2000_stop
int16_t ps2000_stop
(
int16_t handle
)
When running the device in streaming mode, you should always call this function after the end
of a capture to ensure that the scope is ready for the next capture.
When running the device in block mode or ETS mode, you can call this function to interrupt
data capture.
Note that if you are using block mode or ETS mode and call this function before the
oscilloscope is ready, no capture will be available and the driver will not return any samples.
non-zero: if successful
5.34 my_get_overview_buffers
void my_get_overview_buffers
(
int16_t **overviewBuffers,
int16_t overflow,
uint32_t triggeredAt,
int16_t triggered,
int16_t auto_stop,
uint32_t nValues
)
This is the callback function in your application that receives data from the driver in fast
streaming mode. You pass a pointer to this function to
ps2000_get_streaming_last_values, which then calls it back when the data is ready.
Your callback 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 function name my_get_overview_buffers is arbitrary. When you write this function,
you can give it any name you wish. The PicoScope driver does not need to know your
function's name, as it refers to it only by the pointer that you pass to
ps2000_get_streaming_last_values.
For an example of a suitable callback function, see the programming examples included in the
Pico Technology SDK.
overflow: a bit field that indicates whether there has been a voltage
overflow and, if so, on which channel. The bit assignments are as follows:
Bit 0 - Ch A overflow
Bit 1 - Ch B overflow
6 Programming examples
Your SDK installation includes programming examples in several languages and development
environments. Please refer to the SDK for details.
8 Glossary
Aggregation. In fast streaming mode, the PicoScope 2000 driver can use a method called
aggregation to reduce the amount of data your application needs to process. This means that
for every block of consecutive samples, it stores only the minimum and maximum values. You
can set the number of samples in each block, called the aggregation parameter, when you call
ps2000_run_streaming_ns for real-time capture, and when you call
ps2000_get_streaming_values to obtain post-processed data.
Analog bandwidth. The input frequency at which the signal amplitude has fallen by 3 dB, or by
half the power, from its nominal value.
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 is the best mode to use when the input signal being
sampled contains high frequencies. To avoid aliasing effects, the sampling rate must be greater
than twice the maximum frequency in the input signal.
Buffer size. The size of the oscilloscope's buffer memory. The oscilloscope uses this to store
data temporarily so that it can sample data independently of the speed at which it can transfer
data to the computer.
Coupling mode. This mode selects either AC or DC coupling in the oscilloscope's input path.
Use AC mode for small signals that may be superimposed on a DC level. Use DC mode for
measuring absolute voltage levels. Set the coupling mode using ps2000_set_channel.
Driver. A piece of software that controls a hardware device. The driver for the PicoScope
2000 Series PC Oscilloscopes is supplied in the form of a 32-bit Windows DLL, which contains
functions that you can call from your application.
ETS. Equivalent time sampling. Some PicoScope 2000 Series oscilloscopes can collect data
over a number of cycles of a repetitive waveform to give a higher effective sampling rate than
is possible for a single cycle. Equivalent time sampling allows the oscilloscope to use faster
timebases than those available in real-time mode.
Maximum sampling rate. A figure indicating the maximum number of samples the
oscilloscope is capable of acquiring per second. Maximum sample rates are usually given in
MS/s (megasamples per second) or GS/s (gigasamples per second). The higher the sampling
speed of the oscilloscope, the more accurate the representation of the high-frequency details
in a fast signal.
Overview buffer. A buffer in the PC's memory in which the PicoScope 2000 Series driver
temporarily stores data on its way from the oscilloscope to the application's buffer.
PicoScope 2000 Series. A range of low-cost PC Oscilloscopes that includes the PicoScope
2202, 2203, 2204 and 2205 two-channel oscilloscopes and the PicoScope 2104 and 2105
handheld oscilloscopes.
Real-time continuous mode. A sampling mode in which the software repeatedly requests
single samples from the oscilloscope. This mode is suitable for low sampling rates when you
require the latest sample to be displayed as soon as it is captured.
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 suitable when the input signal
being sampled contains only low frequencies.
Timebase. A number that is supplied to the driver to specify a sampling rate for the
oscilloscope. Each oscilloscope model has a different range of possible sampling frequencies,
as specified in the User's Guide for that model.
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, that indicates the number of input voltage levels that the
oscilloscope can distinguish. Calculation techniques can improve the effective resolution.
Voltage range. The range of input voltages that the oscilloscope will measure in a given
mode.
ps2000_get_streaming_values 21
Index ps2000_get_streaming_values_no_aggregation 23
ps2000_get_timebase 25
ps2000_get_times_and_values 26
A ps2000_get_unit_info 28
ps2000_get_values 29
AC/DC control 9, 46, 63
ps2000_last_button_press 30
Advanced triggering 40, 42, 43, 50
ps2000_open_unit 31
Aggregation 14, 21, 39, 63
ps2000_open_unit_async 32
Aliasing 10
ps2000_open_unit_progress 33
Analog bandwidth 63
ps2000_overview_buffer_status 34
Arbitrary wveform generator 52
ps2000_ready 36
AWG 52
ps2000_run_block 37
ps2000_run_streaming 38
B ps2000_run_streaming_ns 39
Block mode 9, 10, 11, 15, 37, 63 ps2000_set_channel 46
using 11 ps2000_set_ets 47
Buffer size 63 ps2000_set_led 49
ps2000_set_light 48
C ps2000_set_sig_gen_arbitrary 52
ps2000_set_sig_gen_built_in 54
Callback 59
ps2000_set_trigger 56
Channel 8, 9, 46, 56, 57
ps2000_set_trigger2 57
Closing a unit 18
ps2000_stop 58
Compatible streaming mode 13
ps2000PingUnit 35
using 13
ps2000SetAdvTriggerChannelConditions 40
Coupling mode 63
ps2000SetAdvTriggerChannelDirections 42
ps2000SetAdvTriggerChannelProperties 43
D ps2000SetAdvTriggerDelay 45
Data acquisition 14 ps2000SetPulseWidthQualifier 50
Data logger 5
Delayed trigger 45 H
Driver 8, 63
Headlight 48
error codes 62
High-precision scopes 14
E L
Equivalent time sampling 63
LED 19, 49
Error codes 62
License conditions 6
ETS 47, 63
Light 48
mode 15
mode, using 15
M
F Maximum sampling rate 63
Memory in scope 11
Fast streaming mode 14
Multi-unit operation 16
using 14
Functions 17
my_get_overview_buffers 59 N
ps2000_close_unit 18 Normal mode 13
ps2000_flash_led 19
ps2000_get_streaming_last_values 20
O
One-shot signal 15 U
Opening a unit 31, 32, 33 USB 5
Oversampling 10, 63 hub 16
Overview buffer 34, 63
V
P Vertical resolution 10, 64
PC oscilloscope 5, 63 Voltage range 64
PicoLog software 5
picopp.inf 8
picopp.sys 8
W
Warranty 7
PicoScope 2000 Series 5, 16, 62, 63
Windowed mode 13
PicoScope software 5, 8, 62, 64
Ping unit 35
Post-trigger delay 45
Pre-trigger 9
Pre-trigger delay 45
PS2000_PWQ_CONDITIONS structure 51
PS2000_THRESHOLD_DIRECTION constants 42
PS2000_TRIGGER_CHANNEL_PROPERTIES structure 44
PS2000_TRIGGER_CONDITIONS structure 41
R
Real-time continuous mode 64
Resolution, vertical 10
S
Sampling modes 11
Sampling rate 15
Signal generator 9, 11
arbitrary waveforms 52
built-in waveforms 54
Stopping sampling 58
Streaming mode 11, 13, 64
compatible 13
fast 14
normal 13
windowed 13
Sweep 9
System requirements, minimum 5
T
Threshold voltage 9
Time interval 10, 15
Timebase 25, 37, 64
Trademarks 7
Trigger delay 45
Tel: +44 (0) 1480 396 395 Tel: +1 800 591 2796 Tel: +86 21 2226-5152
www.picotech.com
ps2000pg.en-12
Copyright © 2006–2022 Pico Technology Ltd. All rights reserved.