Installation guide

PicoScope 4000 Series (A API) Programmer's Guide 5
Copyright © 2008-2014 Pico Technology Ltd. All rights reserved. ps4000apg.en r1
3 Programming with the PicoScope 4000 Series (A
API)
The ps4000a.dll dynamic link library in your PicoScope installation directory allows
you to program a PicoScope 4000 Series 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 sample programs are installed with your PicoScope software. These show
how to use the functions of the driver software in each of the modes available.
3.1
Driver
Your application will communicate with a PicoScope 4000 API driver called
ps4000a.dll. The driver exports the PicoScope 4000 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 kernel driver, CyUSB3.sys, which has a 64-bit version
and a 32-bit version and works with all operating systems except Windows 8. Windows
8 uses WinUsb.sys on both 32-bit and 64-bit versions. Your application does not
need to call the kernel driver. Once you have installed the PicoScope 6 software,
Windows automatically installs the kernel driver when you plug in the PicoScope 4000
Series PC Oscilloscope for the first time.
3.2
Voltage ranges
The ps4000aSetChannel function 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 between maximum and minimum values
that are defined as constants and can also be queried by calling two functions:
Constant
Function
Voltage
PS4000A_MAX_VALUE
ps4000aMaximumValue
maximum
PS4000A_MIN_VALUE
ps4000aMinimumValue
minimum
PS4000A_LOST_DATA
[1]
Note 1. In streaming mode, this special value indicates a buffer overrun.