3 System requirements ..................................................................................................................................................... 9
2 Voltage ranges ............................................................................................................................................................... 11
4 API functions ......................................................................................................................... 27
1 ps4000aChangePowerSource() – handle dual-port USB powering .................................................................. 28
2 ps4000aCloseUnit() – close a scope device ......................................................................................................... 30
3 ps4000aCurrentPowerSource() – read current power source ........................................................................... 31
4 ps4000aEnumerateUnits() – find out how many units are connected ............................................................ 32
5 ps4000aFlashLed() – flash the front-panel LED ................................................................................................... 33
6 ps4000aGetAnalogueOffset() – find the allowable analog offset range ....................................................... 34
7 ps4000aGetChannelInformation() – find out if extra ranges available ........................................................... 35
8 ps4000aGetCommonModeOverflow() – find out which channels have overflowed ................................... 36
9 ps4000aGetDeviceResolution() – query the ADC resolution ............................................................................. 37
10 ps4000aGetMaxDownSampleRatio() – find out downsampling ratio for data ........................................... 38
11 ps4000aGetMaxSegments() – get maximum number of memory segments ............................................ 39
20 ps4000aGetUnitInfo() – read information about scope device ...................................................................... 49
21 ps4000aGetValues() – retrieve block-mode data .............................................................................................. 50
22 ps4000aGetValuesAsync() – retrieve block or streaming data ..................................................................... 52
23 ps4000aGetValuesBulk() – retrieve more than one waveform at a time ..................................................... 53
24 ps4000aGetValuesOverlapped() – retrieve data in overlapping blocks ........................................................ 55
1 Using the GetValuesOverlapped functions ............................................................................................... 56
25 ps4000aGetValuesOverlappedBulk() – retrieve overlapping data from multiple segments ................... 57
26 ps4000aGetValuesTriggerTimeOffsetBulk() – get trigger timing adjustments (multiple) ...................... 58
27 ps4000aGetValuesTriggerTimeOffsetBulk64() – get trigger timing adjustments (multiple) ................. 60
28 ps4000aIsLedFlashing() – read status of LED ................................................................................................... 61
29 ps4000aIsReady() – poll the driver in block mode ............................................................................................. 62
30 ps4000aIsTriggerOrPulseWidthQualifierEnabled() – find out whether trigger is enabled ....................... 63
31 ps4000aMaximumValue() – get maximum allowed sample value ................................................................ 64
32 ps4000aMemorySegments() – divide scope memory into segments .......................................................... 65
33 ps4000aMinimumValue() – get minimum allowed sample value .................................................................. 66
34 ps4000aNoOfStreamingValues() – get number of samples in streaming mode ....................................... 67
35 ps4000aNearestSampleIntervalStateless() – find nearest available sampling interval .......................... 68
36 ps4000aOpenUnit() – open a scope device ......................................................................................................... 69
37 ps4000aOpenUnitAsync() – open a scope device without waiting ............................................................... 70
38 ps4000aOpenUnitAsyncWithResolution() – open a flexible-resolution scope ........................................... 71
39 ps4000aOpenUnitProgress() – check progress of OpenUnit() call ............................................................... 72
40 ps4000aOpenUnitWithResolution() – open a flexible-resolution scope ....................................................... 73
41 ps4000aPingUnit() – check that unit is responding ........................................................................................... 74
42 ps4000aQueryOutputEdgeDetect() – query special trigger mode ................................................................. 75
The PicoScope 4444, 4824 and 4000A Series of PC Oscilloscopes from Pico
Technology are compact, high-resolution scope units designed to replace
traditional benchtop oscilloscopes.
This Programmer's Guide explains how to use the ps4000a API, the
Application Programming Interface for the PicoScope 4000 Series (A API) and
PicoScope 4000A Series oscilloscopes. The ps4000a API supports the
following models:
·
PicoScope 4444 4-channel differential oscilloscope (product web page)
·
PicoScope 4824 8-channel oscilloscope (product web page)
·
PicoScope 4224A 2-channel oscilloscope (product web page)
·
PicoScope 4424A 4-channel oscilloscope (product web page)
·
PicoScope 4824A 8-channel oscilloscope (product web page)
Other oscilloscopes in the PicoScope 4000 Series use an older API called ps4000. This is documented in the
original PicoScope 4000 Series Programmer's Guide.
The material contained in this release is licensed, not sold. Pico Technology Ltd grants a license to the person
who installs this software, subject to the conditions listed below.
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 SDK materials (software,
documents, etc.) except the example programs. You may copy and distribute SDK files without restriction, as long
as you do not remove any Pico Technology copyright statements. The example programs 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 website at www.picotech.com. We reserve the right to
charge for updates or replacements sent out on physical media.
2.2Trademarks
Pico Technology, PicoScope and PicoConnect are trademarks of Pico Technology Ltd, registered in the United
Kingdom and other countries.
PicoScope and Pico Technology are registered in the U.S. Patent and Trademark Office.
Windows, Excel and Visual Basic for Applications are registered trademarks or trademarks of Microsoft
Corporation in the USA and other countries. LabVIEW is a registered trademark of National Instruments
Corporation. MATLAB is a registered trademark of The MathWorks, Inc.
Windows 7, 8.1 or 10 (32-bit and 64-bit versions)
Linux and macOS, 64-bit versions only: see picotech.com/downloads for
supported versions
Processor
Memory
Free disk space
As required by the operating system
Ports
USB 3.0 or USB 2.0 port(s)
Introduction
2.3System requirements
To ensure that your PicoScope operates correctly, 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 multicore processor.
USB
The ps4000a driver offers three different methods of recording data, all of which support USB 2.0 and USB 3.0.
The fastest transfer rates between the PC and the PicoScope device are achieved using USB 3.0.
2.4Installation instructions
The PicoSDK installation process varies depending on your operating system. Software and installation
instructions are available from picotech.com/downloads.
Windows users
Visit picotech.com/downloads, select your oscilloscope from the list and download the latest PicoSDK installer,
choosing either the 32-bit or 64-bit version depending on your operating system and software development
environment.
macOS users
If you have already installed PicoScope 6 Beta for macOS, you already have all the drivers installed. If not, visit
picotech.com/downloads, select your oscilloscope from the list and download and install the latest version.
Linux users
Visit Linux Software & Drivers for Oscilloscopes and Data Loggers for full instructions.
The ps4000a.dll dynamic link library in the lib subdirectory of your SDK installation allows you to program a
PicoScope 4000 Series (A API) oscilloscope using standard C function calls.
A typical program for capturing data consists of the following steps:
·
Open the scope unit.
·
Set up the input channels with the required voltage ranges and coupling mode.
·
Set up triggering.
·
Start capturing data. (See Sampling modes, where programming is discussed in more detail.)
·
Wait until the scope unit is ready.
·
Stop capturing data.
·
Copy data to a buffer.
·
Close the scope unit.
Numerous example programs are available on the "picotech" GitHub pages. These show how to use the functions
of the driver software in each of the modes available.
3.1Driver
Microsoft Windows
Your application will communicate with a PicoScope 4000 Series library called ps4000a.dll, which is supplied
in 32-bit and 64-bit versions. The DLL exports the ps4000a function definitions in stdcall format, which is
compatible with a wide range of programming languages.
ps4000a.dll 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 (or CyUsb3.sys on Windows 7). These are installed by PicoSDK and
configured when you plug the oscilloscope into each USB port for the first time. Your application does not call
these drivers directly.
Linux and macOS
Please see the Downloads section of picotech.com for instructions on downloading the drivers for these
operating systems. The drivers use the cdecl calling convention. Linux libraries and dependencies are
distributed via our package repositories. macOS libraries and dependencies are distributed with PicoScope 6 for
2. Apply a sine wave input of
500 mV amplitude to the
oscilloscope.
3. Capture some data using the
desired sampling mode.
4. The data will be encoded as
shown opposite.
·
DC coupling:
The scope accepts all input frequencies from zero (DC) up to its maximum analog
bandwidth.
·
AC coupling:
The scope accepts input frequencies from a few hertz up to its maximum analog
bandwidth. The lower –3 dB cutoff frequency is about 1 Hz.
Programming with the ps4000a API
3.2Voltage ranges
ps4000aSetChannel() allows you to set the voltage range of each input channel of the scope. The allowable
voltage ranges are described in the device data sheet. Each sample is normalized to 16 bits, and the minimum
and maximum values returned to your application are given by ps4000aMinimumValue() and
ps4000aMaximumValue() as follows:
Example
3.3Channel selection
You can switch each channel on and off, and set its coupling mode to either AC or DC, using the
PicoScope 4000 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 PicoScope 4000 trigger functions:
·
ps4000aSetTriggerChannelConditions() – specifies which channels are included in the trigger
logic
·
ps4000aSetTriggerChannelDirections() – specifies the edge or threshold to be used for each
channel
·
ps4000aSetTriggerChannelProperties() – specifies threshold levels, level or window mode, and
Alternatively, the above functions can be run in a single operation by calling ps4000aSetSimpleTrigger().
A trigger event can occur when one of the input channels crosses a threshold voltage on either a rising or a falling
edge. It is also possible to combine up to four inputs by defining multiple trigger conditions.
The driver supports these triggering methods:
·
Simple Edge
·
Advanced Edge
·
Windowing
·
Pulse width
·
Logic
·
Delay
·
Drop-out
·
Runt
The pulse width, delay and drop-out triggering methods additionally require the use of the pulse width qualifier
functions:
The driver can optionally apply a data reduction, or downsampling, process before returning data to the
application. Downsampling is done by firmware on the device and is generally faster than using the PC's own
processor. You instruct the driver to downsample by passing a downSampleRatioMode argument to one of the
data-retrieval functions such as ps4000aGetValues(). You must also pass in an argument called
downSampleRatio: how many raw samples are to be combined into each processed sample.
Retrieving multiple types of downsampled data
You can optionally retrieve data using more than one downsampling mode with a single call to
ps4000aGetValues(). Set up a buffer for each downsampling mode by calling
ps4000aSetDataBuffer(). Then, when calling ps4000aGetValues(), set downSampleRatioMode to
the bitwise OR of the required downsampling modes.
Retrieving both raw and downsampled data
You cannot retrieve raw data and downsampled data in a single operation. If you require both raw and
downsampled data, first retrieve the downsampled data as described above and then continue as follows:
1. Call ps4000aStop().
2. Set up a data buffer for each channel using ps4000aSetDataBuffer() with the ratio mode set to
PS4000A_RATIO_MODE_NONE.
3. Call ps4000aGetValues() to retrieve the data.
Downsampling modes
The available downsampling modes are:
PS4000A_RATIO_MODE_NONE (0)
No downsampling is performed. The downSampleRatio parameter is ignored.
PS4000A_RATIO_MODE_AGGREGATE (1)
The aggregate method generates two buffers of data for every channel, one containing the minimum sample
value for every block of downSampleRatio raw samples, and the other containing the maximum value.
PS4000A_RATIO_MODE_DECIMATE (2)
The decimate method returns the first sample in every block of downSampleRatio successive samples
and discards all the other samples.
PS4000A_RATIO_MODE_AVERAGE (4)
The average method returns the sum of all the samples in each block of downSampleRatio samples,
divided by the length of the block.
The PicoScope 4000 Series PC Oscilloscopes can run in various sampling modes.
·
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.
·
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 slow data collection for chart recorder and data-logging
applications. Streaming mode provides fast streaming at up to 160 MS/s with a USB 3.0 connection.
Downsampling and triggering are supported in this mode.
Data callbacks
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.
In block mode, you can alternatively poll the driver instead of using a callback.
Most of the callback functions have a PICO_STATUS parameter. The driver sends this value to the callback
function to indicate the success or otherwise of the data capture.
Probe callback
The driver can be instructed to signal to your application whenever a probe connection event occurs. It does this
using a callback to a function that you define. See Handling PicoConnect probe interactions.
In block mode, the computer prompts a PicoScope 4000 Series PC Oscilloscope to collect a block of data into its
internal memory. When the oscilloscope has collected the whole block, it signals that it is ready and then
transfers the whole block to the computer's memory through the USB port.
·
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 is allocated
half the memory. These features are handled transparently by the driver. The block size also depends on the
number of memory segments in use (see ps4000aMemorySegments()).
·
Sampling rate. The maximum real-time sampling rate may depend on the number of channels enabled. See
the data sheet for your scope model. You specify the sampling rate by passing a timebase number (see
Timebases) to ps4000aRunBlock().
·
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 ps4000aRunBlock(),
ps4000aStop() and ps4000aGetValues().
·
Downsampling. When the data has been collected, you can set an optional downsampling factor and examine
the data. Downsampling is the process of reducing the amount of data by combining adjacent samples using
one of several algorithms. 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.
·
Memory segmentation. The scope's internal memory can be divided into segments so that you can capture
several waveforms in succession. Configure this using ps4000aMemorySegments().
·
Data retention. The data is lost when a new run is started in the same segment, the number of segments is
changed, or the scope is powered down.
3.6.1.1Using block mode
This is the general procedure for reading and displaying data in block mode using a single memory segment:
1.Open the oscilloscope using ps4000aOpenUnit().
1a.(PicoScope 4444 only) Register your probe interaction callback function using
ps4000aSetProbeInteractionCallback().
2.Select channel ranges and AC/DC coupling using ps4000aSetChannel().
3.Using ps4000aGetTimebase(), select timebases until the required nanoseconds per sample is
located.
4.Use the trigger setup functions ps4000aSetTriggerChannelConditions(),
and ps4000aSetTriggerDelay() to set up the trigger if required.
5.Start the oscilloscope running using ps4000aRunBlock().
6.Wait until the oscilloscope is ready using the ps4000aBlockReady() callback.
7.Use ps4000aSetDataBuffer() to tell the driver where your memory buffer is. For greater efficiency
when doing multiple captures, you can call this function outside the loop, after step 4.
8.Transfer the block of data from the oscilloscope using ps4000aGetValues().
9.Display the data.
10.Repeat steps 5 to 9.
11.Stop the oscilloscope using ps4000aStop().
12.Request new views of stored data using different downsampling parameters: see Retrieving stored data.
Note that if you use ps4000aGetValues() or ps4000aStop() before the oscilloscope is ready, no capture
will be available and the driver will return PICO_NO_SAMPLES_AVAILABLE.
Programming with the ps4000a API
3.6.1.2Asynchronous calls in block mode
ps4000aGetValues() function may take a long time to complete if a large amount of data is being collected.
To avoid hanging the calling thread, it is possible to call ps4000aGetValuesAsync() instead. This
immediately returns control to the calling thread, which then has the option of waiting for the data or calling
ps4000aStop() to abort the operation.
3.6.2Rapid block mode
In normal block mode, the PicoScope 4000 Series scopes collect one waveform at a time. You start the the
device running, wait until all samples are collected by the device, and then download the data to the PC or start
another run. There is a time overhead of tens of milliseconds associated with starting a run, causing a gap
between waveforms. When you collect data from the device, there is another minimum time overhead which is
most noticeable when using a small number of samples.
Rapid block mode allows you to sample several waveforms at a time with the minimum time between
waveforms. On the PicoScope 4824, for example, it reduces the gap from milliseconds to about 2.5 µs.
3.6.2.1Using rapid block mode
You can use rapid block mode with or without downsampling.
Without downsampling
1.Open the oscilloscope using ps4000aOpenUnit().
1a.(PicoScope 4444 only) Register your probe interaction callback function using
ps4000aSetProbeInteractionCallback().
2.Select channel ranges and AC/DC coupling using ps4000aSetChannel().
3.Set the number of memory segments equal to or greater than the number of captures required using
ps4000aMemorySegments(). Use ps4000aSetNoOfCaptures() before each run to specify the
4.Using ps4000aGetTimebase(), select timebases until the required nanoseconds per sample is
located. This will indicate the number of samples per channel available for each segment. If you know that
the number of samples per segment will not exceed the limit, you can call this function after step 2.
5.Use the trigger setup functions ps4000aSetTriggerChannelConditions(),
and ps4000aSetTriggerDelay() to set up the trigger if required.
6.Start the oscilloscope running using ps4000aRunBlock(). You can call
ps4000aGetNoOfCaptures() while capturing is in progress to obtain a count of the number of
waveforms captured. Once all the waveforms have been captured, but ready is not complete, call
ps4000aGetNoOfProcessedCaptures() to obtain the number of captures processed on the PC.
7.Wait until the oscilloscope is ready using the ps4000aBlockReady() callback.
8.Use ps4000aSetDataBuffer() 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 when doing
multiple captures, you can call this function outside the loop, after step 5.
9.Transfer the blocks of data from the oscilloscope using ps4000aGetValuesBulk().
10.Retrieve the time offset for each data segment using
ps4000aGetValuesTriggerTimeOffsetBulk64().
11.Display the data.
12.Repeat steps 6 to 11 if necessary.
13.Stop the oscilloscope using ps4000aStop().
14.Close the device using ps4000aCloseUnit().
With downsampling
To use rapid block mode with downsampling (in aggregation mode), follow steps 1 to 7 above and then proceed
as follows:
8a.Call ps4000aSetDataBuffers() to set up one pair of buffers for every waveform segment required.
9a.Call ps4000aGetValues() for each pair of buffers.
10a.Retrieve the time offset for each data segment using ps4000aGetTriggerTimeOffset64().
Number of memory segments (this should be equal or more than the number of captures required)
// Set the number of waveforms to MAX_WAVEFORMS
ps4000aSetNoOfCaptures(handle, MAX_WAVEFORMS);
pParameter = false;
ps4000aRunBlock
(
handle,
0, // noOfPreTriggerSamples
10000, // noOfPostTriggerSamples
1, // timebase to be used
&timeIndisposedMs, // calculated duration of capture
0, // segmentIndex
lpReady,
&pParameter
);
·
Get number of captures. Call ps4000aGetNoOfCaptures() to find out the number of captures taken by the
device. This is particularly useful if a trigger is being used.
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.
Comments: buffer has been created as a three-dimensional 16-bit integer array, which will contain 1000 samples
as defined by MAX_SAMPLES. There are only 20 buffers set, but it is possible to set up to the number of captures
you have requested.
ps4000aGetValuesBulk
(
handle,
&noOfSamples,
10, // fromSegmentIndex
19, // toSegmentIndex
1, // downSampleRatio
PS4000A_RATIO_MODE_NONE, // downSampleRatioMode
overflow // indices 10 to 19 will be populated
)
Comments: the number of samples could be up to noOfPreTriggerSamples +
noOfPostTriggerSamples, the values set in ps4000aRunBlock(). The samples are always returned from
the first sample taken, unlike the ps4000aGetValues() function which allows the sample index to be set.
This function does not support downsampling. The above segments start at 10 and finish at 19 inclusive. It is
possible for the fromSegmentIndex to wrap around to the toSegementIndex, by setting the
fromSegmentIndex to 98 and the toSegmentIndex to 7.
ps4000aGetValuesTriggerTimeOffsetBulk64
(
handle,
times, // indices 10 to 19 will be populated
timeUnits, // indices 10 to 19 will be populated
10, // fromSegmentIndex, inclusive
19 // toSegmentIndex, inclusive
)
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 98 and the toSegmentIndex
Number of memory segments (this should be equal or more than the number of captures required)
// Set the number of waveforms to MAX_WAVEFORMS
ps4000aSetNoOfCaptures(handle, MAX_WAVEFORMS);
pParameter = false;
ps4000aRunBlock
(
handle,
0, // noOfPreTriggerSamples
1000000, // noOfPostTriggerSamples
1, // timebase to be used
&timeIndisposedMs, // calculated duration of capture
1, // segmentIndex
lpReady,
&pParameter
);
·
Get number of captures. Call ps4000aGetNoOfCaptures() to find out the number of captures taken by the
device. This is particularly useful if a trigger is being used.
Comments: the set-up for running the device is exactly the same whether or not you use downsampling when you
retrieve the samples.
for (int32_t segment = 10; segment < 20; segment++)
{
for (int32_t c = PS4000A_CHANNEL_A; c <= PS4000A_CHANNEL_H; c++)
{
ps4000aSetDataBuffers
(
handle,
c,
bufferMax[c],
bufferMin[c]
MAX_SAMPLES,
segment,
downSampleRatioMode// set to RATIO_MODE_AGGREGATE
&noOfSamples, // set to MAX_SAMPLES on entering
1000,
downSampleRatioMode,// set to RATIO_MODE_AGGREGATE
segment,
overflow
);
ps4000aGetTriggerTimeOffset64
(
handle,
&time,
&timeUnits,
segment
)
}
Comments: each waveform is retrieved one at a time from the driver, with an aggregation of 1000. 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 samples.
Programming with the ps4000a API
3.6.3Streaming mode
Streaming mode can capture data without the gaps that occur between blocks when using block mode. It can
transfer data to the PC at speeds of up to 160 MS/s for the PicoScope 4824 and 4000A Series, or up to 100 MS/s
for the PicoScope 4444, depending on the computer's performance. This makes it suitable for high-speed data
acquisition, allowing you to capture long data sets limited only by the computer's memory.
Downsampling
The driver returns downsampled readings while the device is streaming. If the downsampling ratio is set to 1, only
one buffer is returned per channel. When the downsampling ratio is greater than 1 and aggregation mode is
selected, two buffers (maximum and minimum) per channel are returned.
The ps4000a API allows you to select any of 232 different timebases created by dividing the oscilloscope's
master sampling clock. 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 ps4000aGetTimebase() or refer to the following tables:
PicoScope 4444
* 12-bit sampling mode only
PicoScope 4824 and 4000A Series
Notes
1. The maximum possible sampling rate may depend on the number of enabled channels and (for flexible-
resolution scopes) the selected ADC resolution. Refer to the data sheet for details.
2. In streaming mode, the maximum possible sampling rate may be limited by the speed of the USB interface.
3.8Combining several oscilloscopes
It is possible to collect data using up to 64 PicoScope 4000 Series PC Oscilloscopes at the same time, depending
on the capabilities of the PC. Each oscilloscope must be connected to a separate USB port.
ps4000aOpenUnit() returns a handle to an oscilloscope. All the other functions require this handle for
oscilloscope identification. For example, to collect data from two oscilloscopes at the same time:
CALLBACK ps4000aBlockReady(...)
// Define callback function specific to application
In addition to ps4000aApi.h, you must also include PicoConnectProbes.h. This file
contains definitions of enumerated types that describe the PicoConnect probes.
Programming with the ps4000a API
3.9Handling PicoConnect probe interactions
The PicoScope 4444 has a PicoConnect™ intelligent probe interface. This interface supplies power to the probe
as well as allowing the scope to configure and interrogate the probe. Your application can choose to be alerted
whenever a probe is connected or disconnected, or when its status changes.
Probe interactions use a callback mechanism, available in C and similar languages. For languages that do not
support callbacks, use the wrapper functions provided.
Procedure
1. Define your own function to receive probe interaction callbacks.
2. Call ps4000aOpenUnit() to obtain a device handle.
3. Call ps4000aSetProbeInteractionCallback() to register your probe interaction callback function.
4. Capture data using the desired sampling mode. See Sampling modes for details.
5. Call ps4000aCloseUnit() to release the device handle. The makes the scope device available to other
The ps4000a 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
Whenever the power supply mode is changed, all data and settings in the scope device are lost. You must then
reconfigure the device before restarting capture.
PicoScope 4444 only
The PicoScope 4444 can use DC power from either a USB 2.0 or a USB 3.0 port. USB 3.0 might be needed if the
probes connected draw enough supply current. If another function returns
PICO_PROBE_POWER_DC_POWER_SUPPLY_REQUIRED or
PICO_PROBE_NOT_POWERED_WITH_DC_POWER_SUPPLY, you must call this function to change to the correct
power source.
The PicoScope 4444 returns PICO_POWER_SUPPLY_NOT_CONNECTED if the DC power supply is not
connected.
All USB 3.0 devices (PicoScope 4824 and 4000A Series)
When the device is plugged into a non-USB 3.0 port, it requires a two-stage power-up sequence. You must call
this function if any of the following conditions arises:
·
USB power is required.
·
The power supply is connected or disconnected during use.
·
A 2-channel USB 3.0 scope is plugged into a USB 2.0 port (indicated if any function returns the
PICO_USB3_0_DEVICE_NON_USB3_0_PORT status code).
If you receive the PICO_USB3_0_DEVICE_NON_USB3_0_PORT status code from one of the
This function disconnects the PicoScope device from the ps4000a driver. Once disconnected, the device can
then be opened or enumerated by this or another application.
This function counts the number of PicoScope 4000 Series (A API) units connected to the computer, and returns
a list of serial numbers as a string. Note that this function will only detect devices that are not yet being controlled
by an application.
range, the voltage range to be used when gathering the min and max information.
coupling, the type of AC/DC coupling used.
* maximumVoltage, on exit, the maximum voltage allowed for the range. Pointer may be
NULL if not required.
* minimumVoltage, on exit, the minimum voltage allowed for the range. Pointer may be
NULL if not required. If both maximumVoltage and minimumVoltage are NULL, the
On each channel of a differential oscilloscope, both the positive and negative differential input voltages must
remain within the specified limits to avoid measurement errors. These limits are independent of the differential
voltage limit, which is the maximum voltage difference allowed between the two inputs.
This function queries whether any channel has exceeded the common mode voltage limit.
This function obtains details of the shortest (fastest) timebase available on the specified device with the
specified combination of enabled channels and resolution. It does not change any settings on the device.
4.13ps4000aGetNoOfCaptures() – get number of rapid
block captures
PICO_STATUS ps4000aGetNoOfCaptures
(
int16_t handle,
uint32_t* nCaptures
)
This function gets the number of captures collected in one run of rapid block mode. You can call it during device
capture, after collection has completed or after interrupting waveform collection by calling ps4000aStop().
4.14ps4000aGetNoOfProcessedCaptures() – get number
of downsampled rapid block captures
PICO_STATUS ps4000aGetNoOfProcessedCaptures
(
int16_t handle,
uint32_t* nProcessedCaptures
)
This function gets the number of captures collected and processed in one run of rapid block mode. It enables
your application to start processing captured data while the driver is still transferring later captures from the
device to the computer.
The function returns the number of captures the driver has processed since you called ps4000aRunBlock(). It
is for use in rapid block mode, alongside ps4000aGetValuesOverlappedBulk(), when the driver is set to
transfer data from the device automatically as soon as the ps4000aRunBlock() function is called. You can
call ps4000aGetNoOfProcessedCaptures() during device capture, after collection has completed or after
interrupting waveform collection by calling ps4000aStop().
The returned value (nProcessedCaptures) can then be used to iterate through the number of segments using
ps4000aGetValues(), or in a single call to ps4000aGetValuesBulk(), where it is used to calculate the
toSegmentIndex parameter.
When capture is stopped
If nProcessedCaptures = 0, you will also need to call ps4000aGetNoOfCaptures(), in order to determine
how many waveform segments were captured, before calling ps4000aGetValues() or
timebase, a code between 0 and 232–1 that specifies the sampling interval (see
Timebases).
noSamples, the number of samples required.
* timeIntervalNanoseconds, on exit, the time interval between readings at the
selected timebase. If a null pointer is passed, nothing will be written here.
* maxSamples, on exit, the maximum number of samples available. The scope allocates a
certain amount of memory for internal overheads and this may vary depending on the
number of segments, number of channels enabled, and the timebase chosen. If this pointer
is null, nothing will be written here.
segmentIndex, the number of the memory segment to use.
This function gets the trigger time offset for waveforms in block mode or rapid block mode. The trigger time
offset is an adjustment value used for correcting jitter in the waveform, and is intended mainly for applications
that wish to display the waveform with reduced jitter. The offset is zero if the waveform crosses the threshold at
the trigger sampling instant, or a positive or negative value if jitter correction is required. The value should be
added to the nominal trigger time to get the corrected trigger time.
Call this function after data has been captured or when data has been retrieved from a previous capture.
This function is provided for use in programming environments that do not support 64-bit integers. Another
version of this function, ps4000aGetTriggerTimeOffset64(), is available that returns the time as a single
64-bit value.
0: PICO_DRIVER_VERSION, version number of ps4000a DLL
1.0.4.56
1: PICO_USB_VERSION, type of USB connection to device: 1.1, 2.0 or 3.0
3.0
2: PICO_HARDWARE_VERSION, hardware version of device
1
3: PICO_VARIANT_INFO, variant number of device
4824
4: PICO_BATCH_AND_SERIAL, batch and serial number of device
KJ087/0006
5: PICO_CAL_DATE, calibration date of device
11Nov13
6: PICO_KERNEL_VERSION, version of kernel driver
1.0
7: PICO_DIGITAL_HARDWARE_VERSION, version of digital board
1
8: PICO_ANALOGUE_HARDWARE_VERSION, version of analog board
1
9: PICO_FIRMWARE_VERSION_1
1.4.0.0
10: PICO_FIRMWARE_VERSION_2
0.9.15.0
API functions
4.20ps4000aGetUnitInfo() – read information about
scope device
PICO_STATUS ps4000aGetUnitInfo
(
int16_t handle,
int8_t* string,
int16_t stringLength,
int16_t* requiredSize,
PICO_INFO info
)
This function writes information about the specified scope device to a character string. If the device fails to open,
only the driver version and error code are available to explain why the last open unit call failed.
This function retrieves block-mode 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, and store it in a user
buffer previously passed to ps4000aSetDataBuffer() or ps4000aSetDataBuffers(). It blocks the
calling function while retrieving data.
If multiple channels are enabled, a single call to this function is sufficient to retrieve data for all channels.
Note that if you are using block mode and call this function before the oscilloscope is ready, no capture will be
available and the driver will return PICO_NO_SAMPLES_AVAILABLE.
This function returns data, either with or without downsampling, starting at the specified sample number. It can
be used in block mode to retrieve data from the device, using a callback so as not to block the calling function. It
can also be used in streaming mode to retrieve data from the driver, but in this case it blocks the calling function.
This function allows more than one waveform to be retrieved at a time in rapid block mode. The waveforms must
have been collected sequentially and in the same run.
If multiple channels are enabled, a single call to this function is sufficient to retrieve data for all channels.
* noOfSamples, on entry, the number of samples required; on exit, the actual number
retrieved. The number of samples retrieved will not be more than the number requested. The
data retrieved always starts with the first sample captured.
fromSegmentIndex, the first segment from which waveforms should be retrieved.
toSegmentIndex, the last segment from which waveforms should be retrieved.
downSampleRatio, downSampleRatioMode, see Downsampling.
* overflow, an array of at least as many integers as the number of waveforms to be
retrieved. Each segment index has a separate overflow element, with overflow[0]
containing the fromSegmentIndex and the last index the toSegmentIndex. Each
element in the array is a bit field as described under ps4000aGetValues().
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 ps4000aRunBlock(). The advantage of this function is that the
driver makes contact with the scope only once, when you call ps4000aRunBlock(), compared with the two
contacts that occur when you use the conventional ps4000aRunBlock(), ps4000aGetValues() calling
sequence. This slightly reduces the dead time between successive captures in block mode.
After calling ps4000aRunBlock(), you can optionally use ps4000aGetValues() to request further copies
of the data. This might be required if you wish to display the data with different data reduction settings.
If multiple channels are enabled, a single call to this function is sufficient to retrieve data for all channels.
This procedure is similar to that described in Using block mode, with differences shown in italics:
1.Open the oscilloscope using ps4000aOpenUnit().
2.Select channel ranges and AC/DC coupling using ps4000aSetChannel().
3.Using ps4000aGetTimebase(), select timebases until the required nanoseconds per sample is located.
4.Use the trigger setup functions ps4000aSetTriggerChannelDirections() and
ps4000aSetTriggerChannelProperties() to set up the trigger if required.
4a. Use ps4000aSetDataBuffer() to tell the driver where your memory buffer is.
4b. Set up the transfer of the block of data from the oscilloscope using ps4000aGetValuesOverlapped().
5.Start the oscilloscope running using ps4000aRunBlock().
6.Wait until the oscilloscope is ready using the ps4000aBlockReady() callback (or poll using
ps4000aIsReady()).
7.(not needed)
8.(not needed)
9.Display the data.
10. Repeat steps 5 to 9 if needed.
11. Stop the oscilloscope using ps4000aStop().
12. Request new views of stored data using different downsampling parameters: see Retrieving stored data.
13. Close the device using ps4000aCloseUnit().
A similar procedure can be used with rapid block mode using ps4000aGetValuesOverlappedBulk().
* timesUpper, an array of integers. On exit, the most significant 32 bits of the time offset
for each requested segment index. times[0] will hold the fromSegmentIndex time
offset and the last times index will hold the toSegmentIndex time offset. The array must
be long enough to hold the number of requested times.
* timesLower, an array of integers. On exit, the least significant 32 bits of the time offset
for each requested segment index. times[0] will hold the fromSegmentIndex time
offset and the last times index will hold the toSegmentIndex time offset. The array size
must be long enough to hold the number of requested times.
* timeUnits, an array of integers. The array must be long enough to hold the number of
requested times. On exit, timeUnits[0] will contain the time unit for
fromSegmentIndex and the last element will contain the time unit for toSegmentIndex.
Refer to ps4000aGetTriggerTimeOffset() for specific figures.
fromSegmentIndex, the first segment for which the time offset is required.
toSegmentIndex, the last segment for which the time offset is required. If
toSegmentIndex is less than fromSegmentIndex then the driver will wrap around from
This function retrieves the trigger time offset for multiple waveforms obtained in block mode or rapid block mode.
It is a more efficient alternative to calling ps4000aGetTriggerTimeOffset() once for each waveform
required. See ps4000aGetTriggerTimeOffset() for an explanation of trigger time offsets.
This function is provided for use in programming environments that do not support 64-bit integers. If your
programming environment does support 64-bit integers, it is easier to use
* 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.
* timeUnits, an array of integers long enough to hold the number of requested times.
timeUnits[0] will contain the time unit for fromSegmentIndex, and the last element
will contain the toSegmentIndex. Refer to ps4000aGetTriggerTimeOffset64() for
specific figures.
fromSegmentIndex, the first segment for which the time offset is required. The results for
this segment will be placed in times[0] and timeUnits[0].
toSegmentIndex, the last segment for which the time offset is required. The results for
this segment will be placed in the last elements of the times and timeUnits arrays. If
toSegmentIndex is less than fromSegmentIndex, then the driver will wrap around from
This function is equivalent to ps4000aGetValuesTriggerTimeOffsetBulk() but retrieves the trigger time
offsets as 64-bit values instead of pairs of 32-bit values.
4.29ps4000aIsReady() – poll the driver in block mode
PICO_STATUS ps4000aIsReady
(
int16_t handle,
int16_t* ready
)
This function may be used instead of a callback function to receive data from ps4000aRunBlock(). To use
this method, pass a NULL pointer as the lpReady argument to ps4000aRunBlock(). You must then poll the
driver to see if it has finished collecting the requested samples.
Call after setting up the trigger, and just before calling either ps4000aRunBlock() or
ps4000aRunStreaming().
Arguments
handle, identifier for the scope device.
* triggerEnabled, on exit, indicates whether the trigger will successfully be set when
ps4000aRunBlock() or ps4000aRunStreaming() is called. A non-zero value indicates
that the trigger is set, otherwise the trigger is not set.
* pulseWidthQualifierEnabled, on exit, indicates whether the pulse width qualifier
will successfully be set when ps4000aRunBlock() or ps4000aRunStreaming() is
called. A non-zero value indicates that the pulse width qualifier is set, otherwise the pulse
width qualifier is not set.
nSegments, the number of segments to be used, from 1 to the number returned by
ps4000aGetMaxSegments().
* nMaxSamples, on exit, the number of samples that are available in each segment. This
is the total number over all channels, so if more than one channel is in use, the number of
samples available to each channel is nMaxSamples divided by 2 (for 2 channels) or 4 (for 3
or 4 channels) or 8 (for 5 to 8 channels).
This function sets the number of memory segments that the scope device will use.
By default, each capture fills the scope device's available memory. This function allows you to divide the memory
into a number of segments so that the scope can store several captures sequentially. The number of segments
defaults to 1 when the scope device is opened.
This function queries the nearest available sampling interval given a desired sampling interval and a device
configuration. It does not change the configuration of the device.
–1: if the unit fails to open,
0: if no unit is found or
> 0 : if successful (value is handle of the device opened)
handle must be used in all subsequent calls to API functions to identify this scope device.
* serial, on entry, an empty string, a serial number string or NULL; on exit, a null-
terminated string containing the device's serial number. If serial is NULL, the function
opens the first scope found; otherwise, it tries to open the scope that matches the string.
This function opens a scope device. The maximum number of units that can be opened is determined by the
operating system, the kernel driver and the PC's hardware.
PicoScope 4824 and 4000A Series only: If the function returns PICO_USB3_0_DEVICE_NON_USB3_0_PORT,
the application must call ps4000aChangePowerSource() to complete the two-stage power-up sequence for
a USB 2.0 port (or USB 3.0 port with USB 2.0 cable). Returns PICO_OK if connected to a USB 3.0 port.
PicoScope 4444 only: If the function returns PICO_POWER_SUPPLY_NOT_CONNECTED, the application must
call ps4000aChangePowerSource() to complete the two-stage power-up sequence for a USB 2.0 or USB 3.0
port. Returns PICO_POWER_SUPPLY_CONNECTED if a power supply is connected.
PicoScope 4444 only: This function opens the device with the lowest available resolution. To open the device with
a different resolution, use ps4000aOpenUnitWithResolution().
This function opens a scope device without blocking the calling thread. You can find out when it has finished by
periodically calling ps4000aOpenUnitProgress() until that function returns a non-zero value.
This function checks on the progress of ps4000aOpenUnitAsync(). For status codes related to USB 2.0
powering, see ps4000aOpenUnit().
PicoScope 4444: returns PICO_POWER_SUPPLY_NOT_CONNECTED on completion if no power supply is
connected; returns PICO_OK if a power supply is connected.
PicoScope 4824 and 4000A Series: returns PICO_USB3_0_DEVICE_NON_USB3_0_PORT if connected to a
USB 2.0 port, or to any type of port through a USB 2.0 cable. Returns PICO_OK if connected to a USB 3.0 port.
noOfPreTriggerSamples, the number of samples to return before the trigger event. If no
trigger has been set, then this argument is added to noOfPostTriggerSamples to give
the maximum number of data points (samples) to collect.
noOfPostTriggerSamples, the number of samples to return after the trigger event. If no
trigger event has been set, then this argument is added to noOfPreTriggerSamples to
give the maximum number of data points to collect. If a trigger condition has been set, this
specifies the number of data points to collect after a trigger has fired, and the number of
data points to be collected is:
noOfPreTriggerSamples + noOfPostTriggerSamples
timebase, a number in the range 0 to 232–1. See the guide to calculating timebase values.
* timeIndisposedMs, on exit, the time, in milliseconds, that the scope will spend
collecting samples. This does not include any auto trigger timeout. If this pointer is null,
nothing will be written here.
segmentIndex, zero-based, specifies which memory segment to use.
lpReady, a pointer to the ps4000aBlockReady() callback that the driver will call when
the data has been collected. To use the ps4000aIsReady() polling method instead of a
callback function, set this pointer to NULL.
* pParameter, a void pointer that is passed to the ps4000aBlockReady() callback
function. The callback can use the pointer to return arbitrary data to your application.
This function starts collecting data in block mode. For a step-by-step guide to this process, see Using block
mode.
The number of samples is determined by noOfPreTriggerSamples and noOfPostTriggerSamples (see
below for details). The total number of samples must not be more than the memory depth of the segment
referred to by segmentIndex.
This function tells the oscilloscope to start collecting data in streaming mode. When data has been collected
from the device it is downsampled and the values returned to the application. Call
ps4000aGetStreamingLatestValues() to retrieve the data. See Using streaming mode for a step-by-step
guide to this process.
This function always starts collecting data immediately, regardless of the trigger settings. Whether a trigger is set
or not, the total number of samples stored in the driver is always maxPreTriggerSamples +
maxPostTriggerSamples. If autoStop is false, the scope will collect data continuously, using the buffer as
channel, an enumerated type in the following range:
PS4000A_CHANNEL_A … PS4000A_CHANNEL_D
bandwidth, the required cutoff frequency of the filter. See ps4000aApi.h for allowable
values.
Returns
PICO_OK
PICO_USER_CALLBACK
PICO_INVALID_HANDLE
PICO_INVALID_CHANNEL
PICO_NOT_USED (if the device does not have a bandwidth limiter)
PICO_BUSY
PICO_ARGUMENT_OUT_OF_RANGE
PICO_INVALID_BANDWIDTH
waveType, as defined in ps4000aApi.h. Only the following types are allowed:
PS4000A_SINE
PS4000A_SQUARE
PS4000A_DC_VOLTAGE
frequency, the signal repetition frequency in hertz. Range [100, 10 000] for
PS4000A_SQUARE, [100, 100 000] for PS4000A_SINE. Value ignored for
PS4000A_DC_VOLTAGE.
amplitude, the signal amplitude in microvolts. Range [0, 8 000 000]. Value ignored for
PS4000A_DC_VOLTAGE.
offset, the signal offset in microvolts. Range [–4 000 000, +4 000 000]. If offset is
zero, the signal range is [0 V, amplitude]. If the total of offset ± amplitude exceeds
the range [–4 000 000, +4 000 000], the output will be clipped.
This function sets up the CAL pins on the back of the PicoScope 4444 differential oscilloscope. These pins can
generate test signals for use when compensating scope probes.
channel, the channel to be configured. The allowable values are:
PS4000A_CHANNEL_A … PS4000A_CHANNEL_B (PicoScope 4224A)
PS4000A_CHANNEL_A … PS4000A_CHANNEL_D (PicoScope 4424A and 4444)
PS4000A_CHANNEL_A … PS4000A_CHANNEL_H (PicoScope 4824A and 4824)
enabled, specifies if the channel is active (TRUE) or inactive (FALSE).
type, specifies the coupling mode: DC (TRUE) or AC (FALSE).
range, specifies the measuring range. This is defined differently depending on the
oscilloscope.
PicoScope 4444: the measuring ranges are defined in PicoConnectProbes.h. Refer
to the PICO_CONNECT_PROBE_RANGE enumeration
(ps4000aProbeInteractions()) for the list, which is specific to each probe.
PicoScope 4824: Measuring ranges 0 to 13, defined ps4000aApi.h, are shown in the
table below.
analogOffset, an offset, in volts, to be added to the input signal before it reaches the
input amplifier and digitizer. See the device data sheet for the allowable range.
Indicates that the channel configuration is not applicable to the PicoConnect probe in
use. Check the most recent probe notification (received via callback) and apply a range
appropriate to your probe.
This function registers your data buffer, for non-aggregated data, with the ps4000a driver. You need to allocate
the buffer before calling this function.
All sampling modes.
All downsampling modes. For non-aggregated data, the simpler
ps4000aSetDataBuffer() can be used instead.
Arguments
handle, identifier for the scope device.
channel, the channel for which you want to set the buffers. See ps4000aSetChannel()
for allowable values.
* bufferMax, a user-allocated buffer to receive the maximum data values in aggregation
mode, or the non-aggregated values otherwise. Each value is a 16-bit ADC count scaled
according to the selected voltage range.
* bufferMin, a user-allocated buffer to receive the minimum data values in aggregation
mode. Not normally used in other modes, but you can direct the driver to write non-aggregated
values to this buffer by setting bufferMax to NULL. To enable aggregation, the
downsampling ratio and mode must be set appropriately when calling one of the
ps4000aGetValues...() functions.
bufferLth, specifies the size of the bufferMax and bufferMin arrays.
segmentIndex, the number of the memory segment to be retrieved.
mode, the type of downsampling to use. See Downsampling.
This function registers your data buffers, for receiving aggregated data, with the ps4000a driver. You need to
allocate memory for the buffers before calling this function.
resolution, determines the resolution of the device when opened. This is chosen from
the available values of PS4000A_DEVICE_RESOLUTION. If resolution is out of range the
device will return PICO_INVALID_DEVICE_RESOLUTION.
Returns
PICO_OK
PICO_INVALID_DEVICE_RESOLUTION
PICO_OS_NOT_SUPPORTED
PICO_OPEN_OPERATION_IN_PROGRESS
PICO_EEPROM_CORRUPT
PICO_KERNEL_DRIVER_TOO_OLD
PICO_FPGA_FAIL
PICO_MEMORY_CLOCK_FREQUENCY
PICO_FW_FAIL
PICO_MAX_UNITS_OPENED
PICO_NOT_FOUND (if the specified unit was not found)
PICO_NOT_RESPONDING
PICO_MEMORY_FAIL
PICO_ANALOG_BOARD
PICO_CONFIG_FAIL_AWG
PICO_INITIALISE_FPGA
PICO_POWER_SUPPLY_NOT_CONNECTED
PICO_USB3_0_DEVICE_NON_USB3_0_PORT
PICO_POWER_SUPPLY_UNDERVOLTAGE
PICO_POWER_SUPPLY_CONNECTED
PICO_TIMEOUT
PICO_RESOURCE_ERROR
PICO_DEVICE_NOT_FUNCTIONING
API functions
4.50ps4000aSetDeviceResolution() – set up a FlexRes
scope
PICO_STATUS ps4000aSetDeviceResolution
(
int16_t handle,
PS4000A_DEVICE_RESOLUTIONresolution
)
This function sets the ADC resolution. Increasing the resolution affects other properties such as the maximum
sampling rate and analog bandwidth. When the resolution is changed, any data captured that has not been saved
will be lost. If ps4000aSetChannel() is not called, ps4000aRunBlock() and ps4000aRunStreaming()
may fail.
4.54ps4000aSetNoOfCaptures() – set number of rapid
block captures
PICO_STATUS ps4000aSetNoOfCaptures
(
int16_t handle,
uint32_tnCaptures
)
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 one waveform.
handle, identifier for the scope device.
state, a flag that specifies the trigger behavior:
0 : do not wait for a signal transition
<> 0 : wait for a signal transition (default)
Returns
PICO_OK
PICO_INVALID_HANDLE
PICO_DRIVER_FUNCTION
API functions
4.55ps4000aSetOutputEdgeDetect() – set special trigger
mode
PICO_STATUS ps4000aSetOutputEdgeDetect
(
int16_thandle,
int16_tstate
)
This function tells the device whether or not to wait for an edge on the trigger input when one of the 'level' or
'window' trigger types is in use. By default the device waits for an edge on the trigger input before firing the trigger.
If you switch off edge detect mode, the device will trigger continually for as long as the trigger input remains in
the specified state.
You can query the state of this flag by calling ps4000aQueryOutputEdgeDetect().
This function registers your ps4000aProbeInteractions() callback function with the ps4000a driver. The
driver will then call your function whenever a PicoConnect™ probe is plugged into, or unplugged from, a PicoScope
4444 device, or if the power consumption of the connected probes exceeds the power available. See Handling
PicoConnect probe interactions for more information on this process.
You should call this function as soon as the device has been successfully opened and before any call to
* conditions: see ps4000aSetTriggerChannelConditions()
nConditions: see ps4000aSetTriggerChannelConditions()
info: see ps4000aSetTriggerChannelConditions()
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. Each call to this function creates a pulse
width qualifier equal to the logical AND of the elements of the conditions array. Calling this function multiple
times creates the logical OR of multiple AND operations. This AND-OR logic allows you to create any possible
Boolean function of the scope's inputs.
To cease ORing pulse width qualifier conditions and start again with a new set, call with
info = PS4000A_CLEAR.
Other settings of the pulse width qualifier are configured by calling
ps4000aSetPulseWidthQualifierProperties().
Note: The oscilloscope contains a single pulse-width counter. It is possible to include multiple channels in a
pulse-width qualifier but the same pulse-width counter will apply to all of them. The counter starts when your
selected trigger condition occurs, and the scope then triggers if the trigger condition ends after a time that
satisfies the pulse-width condition.
direction, the direction of the signal required for the trigger to fire. See
PS4000A_DIRECTION for allowable values. This is also the direction that resets and starts
the counter.
lower, the lower limit of the pulse width counter, in samples.
upper, the upper limit of the pulse width counter, in samples. This parameter is used only
when the type is set to PW_TYPE_IN_RANGE or PW_TYPE_OUT_OF_RANGE.
type, the pulse width type, one of these constants:
PW_TYPE_NONE (do not use the pulse width qualifier)
PW_TYPE_LESS_THAN (pulse width less than lower)
PW_TYPE_GREATER_THAN (pulse width greater than lower)
PW_TYPE_IN_RANGE (pulse width between lower and upper)
PW_TYPE_OUT_OF_RANGE (pulse width not between lower and upper)
This function programs the signal generator to produce an arbitrary waveform.
The arbitrary waveform generator (AWG) 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.
Note 1: in general, this function can be called with new arguments while waiting for a trigger; the exceptions are
the arguments noted above, which must be unchanged on subsequent calls, otherwise the function will return
PICO_BUSY.
Note 2: call this function before starting data acquisition, even if the signal generator will be triggered during data
collection.
Note 3: for more information about using this function, read the article Triggering a PicoScope signal generator
stopDeltaPhase, the final value added to the phase counter before the generator restarts or reverses the
sweep. If required, call ps4000aSigGenFrequencyToPhase() to calculate it. 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.
dwellCount, the time, in multiples of dacPeriod, between successive additions of
deltaPhaseIncrement to the delta phase counter. This determines the rate at which the generator sweeps
the output frequency. Minimum allowable values are as follows:
PicoScope 4824:
MIN_DWELL_COUNT
* arbitraryWaveform, a buffer that holds the waveform pattern as a set of samples equally spaced in
time. Call ps4000aSigGenArbitraryMinMaxValues() to obtain the range of allowable values, or use
these constants:
PicoScope 4824:
[–32768, 32767]
arbitraryWaveformSize, the size of the arbitrary waveform buffer, in samples. Call
ps4000aSigGenArbitraryMinMaxValues() to obtain the range of allowable values, or use these
sweepType, determines whether the startDeltaPhase is swept up to the stopDeltaPhase, or down to
it, or repeatedly up and down. Use one of the following values: UP, DOWN, UPDOWN, DOWNUP.
operation, configures the white noise/PRBS (pseudo-random binary sequence) generator:
PS4000A_ES_OFF:
White noise/PRBS output disabled. The waveform is defined by the other
arguments.
PS4000A_WHITENOISE:
The signal generator produces white noise and ignores all settings except
offsetVoltage and pkTopk.
PS4000A_PRBS:
The signal generator produces a PRBS.
indexMode, specifies how the signal will be formed from the arbitrary waveform data. SINGLE, DUAL and
QUAD index modes are possible (see AWG index modes).
shots, the number of cycles of the waveform to be produced after a trigger event. If this is set to a non-zero
value [1, MAX_SWEEPS_SHOTS], then sweeps must be set to zero.
sweeps, the number of times to sweep the frequency after a trigger event, according to sweepType. If this is
set to a non-zero value [1, MAX_SWEEPS_SHOTS], then shots must be set to zero.
triggerType, the type of trigger that will be applied to the signal generator:
PS4000A_SIGGEN_RISING:
rising edge
PS4000A_SIGGEN_FALLING:
falling edge
PS4000A_SIGGEN_GATE_HIGH:
high level
PS4000A_SIGGEN_GATE_LOW:
low level
triggerSource, the source that will trigger the signal generator:
PS4000A_SIGGEN_NONE:
no trigger (free-running)
PS4000A_SIGGEN_SCOPE_TRIG:
the selected oscilloscope channel (see
ps4000aSetSimpleTrigger())
PS4000A_SIGGEN_SOFT_TRIG:
a software trigger (see ps4000aSigGenSoftwareControl())
SINGLE mode. The generator outputs the raw contents
of the buffer repeatedly. This mode is the only one that
can generate asymmetrical waveforms. You can also
use this mode for symmetrical waveforms, but the dual
and quad modes make more efficient use of the buffer
memory.
DUAL mode. The generator outputs the contents of the
buffer from beginning to end, and then does a second
pass in the reverse direction through the buffer. This
allows you to specify only the first half of a waveform
with twofold symmetry, such as a Gaussian function,
and let the generator fill in the other half.
QUAD mode. The generator outputs the contents of the
buffer, then on its second pass through the buffer
outputs the same data in reverse order as in dual mode.
On the third and fourth passes it does the same but
with a negative version of the data. This allows you to
specify only the first quarter of a waveform with
fourfold symmetry, such as a sine wave, and let the
generator fill in the other three quarters.
outputFrequency
=
repetition rate of the complete arbitrary waveform
dacFrequency
=
update rate of AWG DAC (see table below)
deltaPhase
=
calculated from startDeltaPhase and deltaPhaseIncrement
phaseAccumulatorSize
=
maximum count of phase accumulator (see table below)
awgBufferSize
=
maximum AWG buffer size (see table below)
arbitraryWaveformSize
=
length in samples of the user-defined waveform
API functions
4.59.1AWG index modes
The arbitrary waveform generator supports SINGLE,DUAL and QUAD index modes to make the best use of the
waveform buffer.
4.59.2Calculating deltaPhase
The arbitrary waveform generator steps through the waveform by adding a deltaPhase value between 1 and
phaseAccumulatorSize-1 to the phase accumulator every dacPeriod (1/dacFrequency). If deltaPhase is constant,
the generator produces a waveform at a constant frequency that can be calculated as follows:
where:
You can call ps4000aSigGenFrequencyToPhase() to calculate deltaPhase.
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 specified intervals.
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.
Note 1: in general, this function can be called with new arguments while waiting for a trigger; the exceptions are
the arguments offsetVoltage, pkToPk, arbitraryWaveform, arbitraryWaveformSize and
operation, which must be unchanged on subsequent calls, otherwise the function will return a PICO_BUSY
status code.
Note 2: call this function before starting data acquisition, even if the signal generator will be triggered during data
collection.
Note 3: for more information about using this function, read the article Triggering a PicoScope signal generator