PicoScope 6000 Series PC Oscilloscopes Programmer's Guide ps6000pg.en r9 Copyright © 2009-2013 Pico Technology Ltd. All rights reserved.
PicoScope 6000 Series Programmer's Guide I Contents 1 Introduction....................................................................................................................................1 1 Welcome ........................................................................................................................................1 ........................................................................................................................................
II Contents ......................................................................................................................................................................47 24 ps6000IsTriggerOrPulseWidthQualifierEnabled ......................................................................................................................................................................48 25 ps6000MemorySegments ..........................................................................................
PicoScope 6000 Series Programmer's Guide 1 Introduction 1.1 Welcome 1 The PicoScope 6000 Series of oscilloscopes from Pico Technology is a range of compact high-performance units designed to replace traditional bench-top oscilloscopes and digitizers. This manual explains how to use the Application Programming Interface (API) for the PicoScope 6000 Series scopes.
2 1.2 Introduction Software licence conditions The material contained in this release is licensed, not sold. Pico Technology Limited grants a licence 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.
PicoScope 6000 Series Programmer's Guide 1.4 3 Company details Address: Pico Technology James House Colmworth Business Park ST NEOTS Cambridgeshire PE19 8YP United Kingdom Phone: Fax: +44 (0) 1480 396 395 +44 (0) 1480 396 296 Email: Technical Support: Sales: support@picotech.com sales@picotech.com Web site: www.picotech.com Copyright © 2009-2013 Pico Technology Ltd. All rights reserved. ps6000pg.
4 Product information 2 Product information 2.1 System requirements Using with PicoScope for Windows To ensure that your PicoScope 6000 Series PC Oscilloscope 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.
PicoScope 6000 Series Programmer's Guide 2.2 5 Installation instructions IMPORTANT Install the PicoScope software before connecting your PicoScope 6000 Series oscilloscope to the PC for the first time. This will ensure that Windows correctly recognizes the oscilloscope. Procedure Follow the instructions in the Installation Guide included with your product package. Connect your oscilloscope to the PC using the USB cable supplied.
6 3 Programming with the PicoScope 6000 Series Programming with the PicoScope 6000 Series The ps6000.dll dynamic link library in your PicoScope installation directory allows you to program a PicoScope 6000 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 type. Set up triggering. Start capturing data.
PicoScope 6000 Series Programmer's Guide 3.3 7 Voltage ranges You can set a device input channel to any voltage range from ±50 mV to ±20 V with the ps6000SetChannel function. Each sample is scaled to 16 bits so that the values returned to your application are as follows: Constant PS6000_MIN_VALUE PS6000_MAX_VALUE 3.
8 3.5.1 Programming with the PicoScope 6000 Series Block mode In block mode, the computer prompts a PicoScope 6000 series 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.
PicoScope 6000 Series Programmer's Guide 3.5.1.1 9 Using block mode This is the general procedure for reading and displaying data in block mode using a single memory segment: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 3.5.1.2 Open the oscilloscope using ps6000OpenUnit. Select channel ranges and AC/DC coupling using ps6000SetChannel. Using ps6000GetTimebase, select timebases until the required nanoseconds per sample is located.
10 3.5.2 Programming with the PicoScope 6000 Series Rapid block mode In normal block mode, the PicoScope 6000 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.
PicoScope 6000 Series Programmer's Guide 3.5.2.2 11 Rapid block mode example 1: no aggregation #define MAX_SAMPLES 1000 Set up the device up as usual.
12 Programming with the PicoScope 6000 Series ps6000GetValuesBulk ( handle, &noOfSamples, function 10, 19, 1, PS6000_RATIO_MODE_NONE, overflow ) // set to MAX_SAMPLES on entering the // // // // // fromSegmentIndex toSegmentIndex downsampling ratio downsampling ratio mode an array of size 10 shorts Comments: the number of samples could be up to noOfPreTriggerSamples + noOfPostTriggerSamples, the values set in ps6000RunBlock.
PicoScope 6000 Series Programmer's Guide 3.5.2.3 13 Rapid block mode example 2: using aggregation #define MAX_SAMPLES 1000 Set up the device up as usual.
14 Programming with the PicoScope 6000 Series for (int segment = 10; segment < 20; segment++) { ps6000GetValues ( handle, 0, &noOfSamples, // set to MAX_SAMPLES on entering 1000, &downSampleRatioMode, //set to RATIO_MODE_AGGREGATE index, overflow ); ps6000GetTriggerTimeOffset64 ( handle, &time, &timeUnits, index ) } Comments: each waveform is retrieved one at a time from the driver with an aggregation of 1000. ps6000pg.en r9 Copyright © 2009-2013 Pico Technology Ltd. All rights reserved.
PicoScope 6000 Series Programmer's Guide 3.5.3 15 ETS (Equivalent Time Sampling) ETS is a way of increasing the effective sampling rate of the scope when capturing repetitive signals. It is a modified form of block mode, and is controlled by the ps6000SetTrigger and ps6000SetEts functions. Overview. ETS works by capturing several cycles of a repetitive waveform, then combining them to produce a composite waveform that has a higher effective sampling rate than the individual captures.
16 3.5.3.1 Programming with the PicoScope 6000 Series Using ETS mode This is the general procedure for reading and displaying data in ETS mode using a single memory segment: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. ps6000pg.en r9 Open the oscilloscope using ps6000OpenUnit. Select channel ranges and AC/DC coupling using ps6000SetChannel. Using ps6000GetTimebase, select timebases until the required nanoseconds per sample is located.
PicoScope 6000 Series Programmer's Guide 3.5.4 17 Streaming mode Streaming mode can capture data without the gaps that occur between blocks when using block mode. With USB 2.0 it can transfer data to the PC at speeds of at least 13.33 million samples per second (75 nanoseconds per sample), depending on the computer's performance. With USB 3.0 this speed increases to 78 million samples per second (12 nanoseconds per sample).
18 Programming with the PicoScope 6000 Series 9. 3.5.5 Request new views of stored data using different downsampling parameters: see Retrieving stored data. Retrieving stored data You can collect data from the PicoScope 6000 driver with a different downsampling factor when ps6000RunBlock or ps6000RunStreaming has already been called and has successfully captured all the data. Use ps6000GetValuesAsync. ps6000pg.en r9 Copyright © 2009-2013 Pico Technology Ltd. All rights reserved.
PicoScope 6000 Series Programmer's Guide 3.6 19 Oversampling Note: This feature is provided for backward-compatibility only. The same effect can be obtained more efficiently with the PicoScope 6000 Series using the hardware averaging feature (see Downsampling modes). When the oscilloscope is operating at sampling rates less than its maximum, it is possible to oversample. Oversampling is taking more than one measurement during a time interval and returning the average as one sample.
20 3.8 Programming with the PicoScope 6000 Series Combining several oscilloscopes It is possible to collect data using up to 64 PicoScope 6000 Series oscilloscopes at the same time, depending on the capabilities of the PC. Each oscilloscope must be connected to a separate USB port. The ps6000OpenUnit function returns a handle to an oscilloscope. All the other functions require this handle for oscilloscope identification.
PicoScope 6000 Series Programmer's Guide 3.9 21 API functions The PicoScope 6000 Series API exports the following functions for you to use in your own applications. All functions are C functions using the standard call naming convention (__stdcall). They are all exported with both decorated and undecorated names.
22 3.9.1 Programming with the PicoScope 6000 Series ps6000BlockReady typedef void (CALLBACK *ps6000BlockReady) ( short handle, PICO_STATUS status, void * pParameter ) This callback function is part of your application. You register it with the PicoScope 6000 series driver using ps6000RunBlock, and the driver calls it back when blockmode data is ready. You can then download the data using the ps6000GetValues function.
PicoScope 6000 Series Programmer's Guide 3.9.2 23 ps6000CloseUnit PICO_STATUS ps6000CloseUnit ( short handle ) This function shuts down a PicoScope 6000 oscilloscope. Applicability All modes Arguments handle, the handle, returned by ps6000OpenUnit, of the scope device to be closed. Returns PICO_OK PICO_HANDLE_INVALID PICO_USER_CALLBACK PICO_DRIVER_FUNCTION Copyright © 2009-2013 Pico Technology Ltd. All rights reserved. ps6000pg.
24 3.9.3 Programming with the PicoScope 6000 Series ps6000DataReady typedef void (CALLBACK *ps6000DataReady) ( short handle, PICO_STATUS status, unsigned long noOfSamples, short overflow, void * pParameter ) This is a callback function that you write to collect data from the driver. You supply a pointer to the function when you call ps6000GetValuesAsync, and the driver calls your function back when the data is ready.
PicoScope 6000 Series Programmer's Guide 3.9.4 25 ps6000EnumerateUnits PICO_STATUS ps6000EnumerateUnits ( short * count, char * serials, short * serialLth ) This function counts the number of PicoScope 6000 units connected to the computer, and returns a list of serial numbers as a string. Applicability All modes Arguments * count, on exit, the number of PicoScope 6000 units found * serials, on exit, a list of serial numbers separated by commas and terminated by a final null.
26 3.9.5 Programming with the PicoScope 6000 Series ps6000FlashLed PICO_STATUS ps6000FlashLed ( short handle, short start ) This function flashes the LED on the front of the scope without blocking the calling thread. Calls to ps6000RunStreaming and ps6000RunBlock cancel any flashing started by this function. It is not possible to set the LED to be constantly illuminated, as this state is used to indicate that the scope has not been initialized.
PicoScope 6000 Series Programmer's Guide 3.9.6 27 ps6000GetAnalogueOffset PICO_STATUS ps6000GetAnalogueOffset ( short handle, PS6000_RANGE, range PS6000_COUPLING coupling float * maximumVoltage, float * minimumVoltage ) This function is used to get the maximum and minimum allowable analog offset for a specific voltage range. Applicability Not PicoScope 6407 Arguments handle, range, the value returned from opening the device. the voltage range to be used when gathering the min and max information.
28 3.9.7 Programming with the PicoScope 6000 Series ps6000GetMaxDownSampleRatio PICO_STATUS ps6000GetMaxDownSampleRatio ( short handle, unsigned long noOfUnaggregatedSamples, unsigned long * maxDownSampleRatio, PS6000_RATIO_MODE downSampleRatioMode, unsigned long segmentIndex ) This function returns the maximum downsampling ratio that can be used for a given number of samples in a given downsampling mode.
PicoScope 6000 Series Programmer's Guide 3.9.8 29 ps6000GetNoOfCaptures PICO_STATUS ps6000GetNoOfCaptures ( short handle, unsigned long * nCaptures ) This function finds out how many captures are available after ps6000RunBlock has been called when either the collection completed or the collection of waveforms was interrupted by calling ps6000Stop.
30 3.9.9 Programming with the PicoScope 6000 Series ps6000GetStreamingLatestValues PICO_STATUS ps6000GetStreamingLatestValues ( short handle, ps6000StreamingReady lpPs6000Ready, void * pParameter ) This function instructs the driver to return the next block of values to your ps6000StreamingReady callback function. You must have previously called ps6000RunStreaming beforehand to set up streaming. Applicability Streaming mode only Arguments handle, the handle of the required device.
PicoScope 6000 Series Programmer's Guide 31 3.9.10 ps6000GetTimebase PICO_STATUS ps6000GetTimebase ( short handle, unsigned long timebase, unsigned long noSamples, long * timeIntervalNanoseconds, short oversample, unsigned long * maxSamples unsigned long segmentIndex ) This function calculates the sampling rate and maximum number of samples for a given timebase under the specified conditions. The result will depend on the number of channels enabled by the last call to ps6000SetChannel.
32 Programming with the PicoScope 6000 Series 3.9.11 ps6000GetTimebase2 PICO_STATUS ps6000GetTimebase2 ( short handle, unsigned long timebase, unsigned long noSamples, float * timeIntervalNanoseconds, short oversample, unsigned long * maxSamples unsigned long segmentIndex ) This function is an upgraded version of ps6000GetTimebase, and returns the time interval as a float rather than a long. This allows it to return sub-nanosecond time intervals. See ps6000GetTimebase for a full description.
PicoScope 6000 Series Programmer's Guide 33 3.9.12 ps6000GetTriggerTimeOffset PICO_STATUS ps6000GetTriggerTimeOffset ( short handle unsigned long * timeUpper unsigned long * timeLower PS6000_TIME_UNITS * timeUnits unsigned long segmentIndex ) This function gets the time, as two 4-byte values, at which the trigger occurred. Call it after block-mode data has been captured or when data has been retrieved from a previous block-mode capture.
34 Programming with the PicoScope 6000 Series 3.9.13 ps6000GetTriggerTimeOffset64 PICO_STATUS ps6000GetTriggerTimeOffset64 ( short handle, __int64 * time, PS6000_TIME_UNITS * timeUnits, unsigned long segmentIndex ) This function gets the time, as a single 64-bit value, at which the trigger occurred. Call it after block-mode data has been captured or when data has been retrieved from a previous block-mode capture. A 32-bit version of this function, ps6000GetTriggerTimeOffset, is also available.
PicoScope 6000 Series Programmer's Guide 35 3.9.14 ps6000GetUnitInfo PICO_STATUS ps6000GetUnitInfo ( short handle, char * string, short stringLength, short * requiredSize PICO_INFO info ) This function retrieves information about the specified oscilloscope. If the device fails to open, only the driver version and error code are available to explain why the last open unit call failed. Applicability All modes Arguments handle, the handle of the device from which information is required.
36 Programming with the PicoScope 6000 Series info 0 PICO_DRIVER_VERSION - Version number of PicoScope 6000 Example 1,0,0,1 DLL 1 PICO_USB_VERSION - Type of USB connection to device: 1.1, 3.0 2.0 or 3.
PicoScope 6000 Series Programmer's Guide 37 3.9.15 ps6000GetValues PICO_STATUS ps6000GetValues ( short handle, unsigned long startIndex, unsigned long * noOfSamples, unsigned long downSampleRatio, PS6000_RATIO_MODE downSampleRatioMode, unsigned long segmentIndex, short * overflow ) This function returns block-mode data, with or without downsampling, starting at the specified sample number. It is used to get the stored data from the driver after data collection has stopped.
38 Programming with the PicoScope 6000 Series Returns 3.9.15.
PicoScope 6000 Series Programmer's Guide 39 3.9.16 ps6000GetValuesAsync PICO_STATUS ps6000GetValuesAsync ( short handle, unsigned long startIndex, unsigned long noOfSamples, unsigned long downSampleRatio, PS6000_RATIO_MODE downSampleRatioMode, unsigned long segmentIndex, void * lpDataReady, void * pParameter ) This function returns data either with or without downsampling, starting at the specified sample number. It is used to get the stored data from the scope after data collection has stopped.
40 Programming with the PicoScope 6000 Series 3.9.17 ps6000GetValuesBulk PICO_STATUS ps6000GetValuesBulk ( short handle, unsigned long * noOfSamples, unsigned long fromSegmentIndex, unsigned long toSegmentIndex, unsigned long downSampleRatio, PS6000_RATIO_MODE downSampleRatioMode, short * overflow ) This function retrieves waveforms captured using rapid block mode. The waveforms must have been collected sequentially and in the same run. This method of collection does not support downsampling.
PicoScope 6000 Series Programmer's Guide 41 3.9.18 ps6000GetValuesBulkAsync PICO_STATUS ps6000GetValuesBulkAsync ( short handle, unsigned long startIndex, unsigned long * noOfSamples, unsigned long downSampleRatio, PS6000_RATIO_MODE downSampleRatioMode, unsigned long fromSegmentIndex, unsigned long toSegmentIndex, short * overflow ) This function retrieves more than one waveform at a time in rapid block mode after data collection has stopped.
42 Programming with the PicoScope 6000 Series 3.9.19 ps6000GetValuesOverlapped PICO_STATUS ps6000GetValuesOverlapped ( short handle, unsigned long startIndex, unsigned long * noOfSamples, unsigned long downSampleRatio, PS6000_RATIO_MODE downSampleRatioMode, unsigned long segmentIndex, short * overflow ) This function allows you to make a deferred data-collection request, which will later be executed, and the arguments validated, when you call ps6000RunBlock in block mode.
PicoScope 6000 Series Programmer's Guide 43 3.9.
44 Programming with the PicoScope 6000 Series 3.9.21 ps6000GetValuesTriggerTimeOffsetBulk PICO_STATUS ps6000GetValuesTriggerTimeOffsetBulk ( short handle, unsigned long * timesUpper, unsigned long * timesLower, PS6000_TIME_UNITS * timeUnits, unsigned long fromSegmentIndex, unsigned long toSegmentIndex ) This function retrieves the time offsets, as lower and upper 32-bit values, for waveforms obtained in rapid block mode.
PicoScope 6000 Series Programmer's Guide 45 3.9.22 ps6000GetValuesTriggerTimeOffsetBulk64 PICO_STATUS ps6000GetValuesTriggerTimeOffsetBulk64 ( short handle, __int64 * times, PS6000_TIME_UNITS * timeUnits, unsigned long fromSegmentIndex, unsigned long toSegmentIndex ) This function retrieves the 64-bit time offsets for waveforms captured in rapid block mode.
46 Programming with the PicoScope 6000 Series 3.9.23 ps6000IsReady PICO_STATUS ps6000IsReady ( short handle, short * ready ) This function may be used instead of a callback function to receive data from ps6000RunBlock. To use this method, pass a NULL pointer as the lpReady argument to ps6000RunBlock. You must then poll the driver to see if it has finished collecting the requested samples.
PicoScope 6000 Series Programmer's Guide 47 3.9.24 ps6000IsTriggerOrPulseWidthQualifierEnabled PICO_STATUS ps6000IsTriggerOrPulseWidthQualifierEnabled ( short handle, short * triggerEnabled, short * pulseWidthQualifierEnabled ) This function discovers whether a trigger, or pulse width triggering, is enabled. Applicability Arguments Call after setting up the trigger, and just before calling either ps6000RunBlock or ps6000RunStreaming.
48 Programming with the PicoScope 6000 Series 3.9.25 ps6000MemorySegments PICO_STATUS ps6000MemorySegments ( short handle unsigned long nSegments, unsigned long * nMaxSamples ) This function sets the number of memory segments that the scope will use. When the scope is opened, the number of segments defaults to 1, meaning that each capture fills the scope's available memory. This function allows you to divide the memory into a number of segments so that the scope can store several waveforms sequentially.
PicoScope 6000 Series Programmer's Guide 49 3.9.26 ps6000NoOfStreamingValues PICO_STATUS ps6000NoOfStreamingValues ( short handle, unsigned long * noOfValues ) This function returns the number of samples available after data collection in streaming mode. Call it after calling ps6000Stop.
50 Programming with the PicoScope 6000 Series 3.9.27 ps6000OpenUnit PICO_STATUS ps6000OpenUnit ( short * handle, char * serial ) This function opens a PicoScope 6000 Series scope attached to the computer. The maximum number of units that can be opened depends on the operating system, the kernel driver and the computer.
PicoScope 6000 Series Programmer's Guide 51 3.9.28 ps6000OpenUnitAsync PICO_STATUS ps6000OpenUnitAsync ( short * status char * serial ) This function opens a scope without blocking the calling thread. You can find out when it has finished by periodically calling ps6000OpenUnitProgress until that function returns a non-zero value.
52 Programming with the PicoScope 6000 Series 3.9.29 ps6000OpenUnitProgress PICO_STATUS ps6000OpenUnitProgress ( short * handle, short * progressPercent, short * complete ) This function checks on the progress of a request made to ps6000OpenUnitAsync to open a scope. Applicability Use after ps6000OpenUnitAsync Arguments * handle: see ps6000OpenUnit. This handle is valid only if the function returns PICO_OK. * progressPercent, on exit, the percentage progress towards opening the scope.
PicoScope 6000 Series Programmer's Guide 53 3.9.30 ps6000RunBlock PICO_STATUS ps6000RunBlock ( short handle, unsigned long noOfPreTriggerSamples, unsigned long noOfPostTriggerSamples, unsigned long timebase, short oversample, long * timeIndisposedMs, unsigned long segmentIndex, ps6000BlockReady lpReady, void * pParameter ) This function starts collecting data in block mode. For a step-by-step guide to this process, see Using block mode.
54 Programming with the PicoScope 6000 Series * pParameter, a void pointer that is passed to the ps6000BlockReady callback function. The callback can use this pointer to return arbitrary data to the application. Returns ps6000pg.
PicoScope 6000 Series Programmer's Guide 55 3.9.31 ps6000RunStreaming PICO_STATUS ps6000RunStreaming ( short handle, unsigned long * sampleInterval, PS6000_TIME_UNITS sampleIntervalTimeUnits unsigned long maxPreTriggerSamples, unsigned long maxPostTriggerSamples, short autoStop, unsigned long downSampleRatio, PS6000_RATIO_MODE downSampleRatioMode, unsigned long overviewBufferSize ) This function tells the oscilloscope to start collecting data in streaming mode.
56 Programming with the PicoScope 6000 Series overviewBufferSize, the size of the overview buffers. These are temporary buffers used for storing the data before returning it to the application. The size is the same as the bufferLth value passed to ps6000SetDataBuffer. Returns ps6000pg.
PicoScope 6000 Series Programmer's Guide 57 3.9.32 ps6000SetChannel PICO_STATUS ps6000SetChannel ( short handle, PS6000_CHANNEL channel, short enabled, PS6000_COUPLING type, PS6000_RANGE range, float analogueOffset, PS6000_BANDWIDTH_LIMITER bandwidth ) This function specifies whether an input channel is to be enabled, its input coupling type, voltage range, analog offset and bandwidth limit. Some of the arguments within this function have model-specific values.
58 Programming with the PicoScope 6000 Series range, the input voltage range: PicoScope 6402/6403/6404 (all model variants) ±50 mV ±100 mV ±200 mV ±500 mV ±1 V ±2 V ±5 V ±10 V * ±20 V * * not available when type = PS6000_DC_50R PicoScope 6407 PS6000_50MV: PS6000_100MV: PS6000_200MV: PS6000_500MV: PS6000_1V: PS6000_2V: PS6000_5V: PS6000_10V: PS6000_20V: PS6000_100MV: ±100 mV analogueOffset, a voltage to add to the input channel before digitization.
PicoScope 6000 Series Programmer's Guide Returns 59 PICO_OK PICO_USER_CALLBACK PICO_INVALID_HANDLE PICO_INVALID_CHANNEL PICO_INVALID_VOLTAGE_RANGE PICO_INVALID_COUPLING PICO_INVALID_ANALOGUE_OFFSET PICO_DRIVER_FUNCTION Copyright © 2009-2013 Pico Technology Ltd. All rights reserved. ps6000pg.
60 Programming with the PicoScope 6000 Series 3.9.33 ps6000SetDataBuffer PICO_STATUS ps6000SetDataBuffer ( short handle, PS6000_CHANNEL channel, short * buffer, unsigned long bufferLth, PS6000_RATIO_MODE downSampleRatioMode ) This function tells the driver where to store the data, either unprocessed or downsampled, that will be returned after the next call to one of the GetValues functions.
PicoScope 6000 Series Programmer's Guide 61 3.9.34 ps6000SetDataBufferBulk PICO_STATUS ps6000SetDataBufferBulk ( short handle, PS6000_CHANNEL channel, short * buffer, unsigned long bufferLth, unsigned long waveform, PS6000_RATIO_MODE downSampleRatioMode ) This function allows you to associate a buffer with a specified waveform number and input channel in rapid block mode. The number of waveforms captured is determined by the nCaptures argument sent to ps6000SetNoOfCaptures.
62 Programming with the PicoScope 6000 Series 3.9.35 ps6000SetDataBuffers PICO_STATUS ps6000SetDataBuffers ( short handle, PS6000_CHANNEL channel, short * bufferMax, short * bufferMin, unsigned long bufferLth, PS6000_RATIO_MODE downSampleRatioMode ) This function tells the driver the location of one or two buffers for receiving data. You need to allocate memory for the buffers before calling this function.
PicoScope 6000 Series Programmer's Guide 63 3.9.36 ps6000SetDataBuffersBulk PICO_STATUS ps6000SetDataBuffersBulk ( short handle, PS6000_CHANNEL channel, short * bufferMax, short * bufferMin, unsigned long bufferLth, unsigned long waveform, PS6000_RATIO_MODE downSampleRatioMode ) This function tells the driver where to find the buffers for aggregated data for each waveform in rapid block mode. The number of waveforms captured is determined by the nCaptures argument sent to ps6000SetNoOfCaptures.
64 Programming with the PicoScope 6000 Series 3.9.37 ps6000SetEts PICO_STATUS ps6000SetEts ( short handle, PS6000_ETS_MODE mode, short etsCycles, short etsInterleave, long * sampleTimePicoseconds ) This function is used to enable or disable ETS (equivalent-time sampling) and to set the ETS parameters. See ETS overview for an explanation of ETS mode. Applicability Block mode Arguments handle, the handle of the required device mode, the ETS mode.
PicoScope 6000 Series Programmer's Guide 65 3.9.38 ps6000SetEtsTimeBuffer PICO_STATUS ps6000SetEtsTimeBuffer ( short handle, __int64 * buffer, unsigned long bufferLth ) This function tells the driver where to find your application's ETS time buffers. These buffers contain the 64-bit timing information for each ETS sample after you run a block-mode ETS capture. Applicability ETS mode only.
66 Programming with the PicoScope 6000 Series 3.9.39 ps6000SetEtsTimeBuffers PICO_STATUS ps6000SetEtsTimeBuffers ( short handle, unsigned long * timeUpper, unsigned long * timeLower, unsigned long bufferLth ) This function tells the driver where to find your application's ETS time buffers. These buffers contain the timing information for each ETS sample after you run a blockmode ETS capture.
PicoScope 6000 Series Programmer's Guide 67 3.9.40 ps6000SetExternalClock PICO_STATUS ps6000SetExternalClock ( short handle, PS6000_EXTERNAL_FREQUENCY frequency, short threshold ) This function tells the scope whether or not to use an external clock signal fed into the AUX input. The external clock can be used to synchronise one or more PicoScope 6000 units to an external source. When the external clock input is enabled, the oscilloscope relies on the clock signal for all of its timing.
68 Programming with the PicoScope 6000 Series 3.9.41 ps6000SetNoOfCaptures PICO_STATUS ps6000SetNoOfCaptures ( short handle, unsigned long nCaptures ) This function sets the number of captures to be collected in one run of rapid block mode. If you do not call this function before a run, the driver will capture only one waveform. Applicability Rapid block mode Arguments handle, the handle of the device Returns ps6000pg.
PicoScope 6000 Series Programmer's Guide 69 3.9.42 ps6000SetPulseWidthQualifier PICO_STATUS ps6000SetPulseWidthQualifier ( short handle, PS6000_PWQ_CONDITIONS * conditions, short nConditions, PS6000_THRESHOLD_DIRECTION direction, unsigned long lower, unsigned long upper, PS6000_PULSE_WIDTH_TYPE type ) This function sets up pulse-width qualification, which can be used on its own for pulsewidth triggering or combined with window triggering to produce more complex triggers.
70 Programming with the PicoScope 6000 Series Returns ps6000pg.
PicoScope 6000 Series Programmer's Guide 3.9.42.1 71 PS6000_PWQ_CONDITIONS structure A structure of this type is passed to ps6000SetPulseWidthQualifier in the conditions argument to specify the trigger conditions.
72 Programming with the PicoScope 6000 Series 3.9.
PicoScope 6000 Series Programmer's Guide Applicability PicoScope 6402/3/4, including B and D variants Arguments handle, the handle of the required device 73 offsetVoltage, the voltage offset, in microvolts, to be applied to the waveform pkToPk, the peak-to-peak voltage, in microvolts, of the waveform signal 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 gen
74 Programming with the PicoScope 6000 Series Returns 3.9.43.
PicoScope 6000 Series Programmer's Guide 75 3.9.
76 Programming with the PicoScope 6000 Series Arguments sweepType, whether the frequency will sweep from startFrequency to stopFrequency, or in the opposite direction, or repeatedly reverse direction. Use one of these constants: PS6000_UP PS6000_DOWN PS6000_UPDOWN PS6000_DOWNUP operation, selects periodic signal, white noise or PRBS: PS6000_ES_OFF (0) produces the waveform specified by waveType. PS6000_WHITENOISE (1) produces white noise and ignores all settings except offsetVoltage and pkTopk.
PicoScope 6000 Series Programmer's Guide 77 3.9.45 ps6000SetSimpleTrigger PICO_STATUS ps6000SetSimpleTrigger ( short handle, short enable, PS6000_CHANNEL source, short threshold, THRESHOLD_DIRECTION direction, unsigned long delay, short autoTrigger_ms ) This function simplifies arming the trigger. It supports only the LEVEL trigger types and does not allow more than one channel to have a trigger applied to it. Any previous pulse width qualifier is cancelled.
78 Programming with the PicoScope 6000 Series 3.9.46 ps6000SetTriggerChannelConditions PICO_STATUS ps6000SetTriggerChannelConditions ( short handle, PS6000_TRIGGER_CONDITIONS * conditions, short nConditions ) This function sets up trigger conditions on the scope's inputs. The trigger is defined by one or more PS6000_TRIGGER_CONDITIONS structures that are then ORed together. Each structure is itself the AND of the states of one or more of the inputs.
PicoScope 6000 Series Programmer's Guide 3.9.46.
80 Programming with the PicoScope 6000 Series 3.9.47 ps6000SetTriggerChannelDirections PICO_STATUS ps6000SetTriggerChannelDirections ( short handle, PS6000_THRESHOLD_DIRECTION channelA, PS6000_THRESHOLD_DIRECTION channelB, PS6000_THRESHOLD_DIRECTION channelC, PS6000_THRESHOLD_DIRECTION channelD, PS6000_THRESHOLD_DIRECTION ext, PS6000_THRESHOLD_DIRECTION aux ) This function sets the direction of the trigger for each channel.
PicoScope 6000 Series Programmer's Guide 81 3.9.48 ps6000SetTriggerChannelProperties PICO_STATUS ps6000SetTriggerChannelProperties ( short handle, PS6000_TRIGGER_CHANNEL_PROPERTIES * channelProperties short nChannelProperties short auxOutputEnable, long autoTriggerMilliseconds ) This function is used to enable or disable triggering and set its parameters. Applicability All modes Arguments handle, the handle of the required device.
82 3.9.48.
PicoScope 6000 Series Programmer's Guide 83 3.9.49 ps6000SetTriggerDelay PICO_STATUS ps6000SetTriggerDelay ( short handle, unsigned long delay ) This function sets the post-trigger delay, which causes capture to start a defined time after the trigger event. Applicability All modes Arguments handle, the handle of the required device delay, the time between the trigger occurring and the first sample. For example, if delay=100 then the scope would wait 100 sample periods before sampling.
84 Programming with the PicoScope 6000 Series 3.9.50 ps6000SigGenSoftwareControl PICO_STATUS ps6000SigGenSoftwareControl ( short handle, short state ) This function causes a trigger event, or starts and stops gating. It is used when the signal generator is set to SIGGEN_SOFT_TRIG. Applicability Use with ps6000SetSigGenBuiltIn or ps6000SetSigGenArbitrary.
PicoScope 6000 Series Programmer's Guide 85 3.9.51 ps6000Stop PICO_STATUS ps6000Stop ( short handle ) This function stops the scope device from sampling data. If this function is called before a trigger event occurs, the oscilloscope may not contain valid data. Always call this function after the end of a capture to ensure that the scope is ready for the next capture. Applicability All modes Arguments handle, the handle of the required device.
86 Programming with the PicoScope 6000 Series 3.9.52 ps6000StreamingReady typedef void (CALLBACK *ps6000StreamingReady) ( short handle, unsigned long noOfSamples, unsigned long startIndex, short overflow, unsigned long triggerAt, short triggered, short autoStop, void * pParameter ) This callback function is part of your application. You register it with the driver using ps6000GetStreamingLatestValues, and the driver calls it back when streaming-mode data is ready.
PicoScope 6000 Series Programmer's Guide 3.10 87 Programming examples Your PicoScope SDK installation includes programming examples in various languages and development environments. 3.10.1 C The C example program is a comprehensive console mode program that demonstrates all of the facilities of the driver. To compile the program, create a new project for an Application containing the following files: - ps6000con.c and: ps6000bc.lib ps6000.
88 Programming with the PicoScope 6000 Series 3.10.4 LabVIEW The SDK contains a library of VIs that can be used to control the PicoScope 6000 and some simple examples of using these VIs in streaming mode, block mode and rapid block mode. The LabVIEW library (PicoScope6000.llb) can be placed in the user.lib subdirectory to make the VIs available on the ‘User Libraries’ palette. You must also copy ps6000.dll and ps6000wrap.dll to the folder containing your LabView project.
PicoScope 6000 Series Programmer's Guide 89 PicoScope6000GetRapidBlock.vi - collects a set of data blocks or captures from the oscilloscope in rapid block mode This VI is similar to PicoScope6000GetBlock.vi. It outputs two-dimensional arrays for each channel that contain data from all the requested number of captures. PicoScope6000GetStreamingValues.
90 3.11 Programming with the PicoScope 6000 Series Driver status codes Every function in the ps6000 driver returns a driver status code from the following list of PICO_STATUS values. These definitions can also be found in the file picoStatus.h, which is included in the PicoScope 6000 Series SDK. Not all codes apply to the PicoScope 6000 Series SDK. Code (hex) / Symbol and meaning 00 PICO_OK - The PicoScope 6000 is functioning correctly.
PicoScope 6000 Series Programmer's Guide 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2D 2E 34 35 36 37 38 39 3A 3B 3C 3F 40 41 42 43 45 46 47 49 4A 91 PICO_PULSE_WIDTH_QUALIFIER - A null pointer has been passed in the trigger function or one of the parameters is out of range. PICO_DELAY - One or more of the hold-off parameters are out of range. PICO_SOURCE_DETAILS - One or more of the source details are incorrect. PICO_CONDITIONS - One or more of the conditions are incorrect.
92 Programming with the PicoScope 6000 Series 4D 4E 4F 50 51 52 53 54 56 57 58 59 5A 5B 5C 5D 5E 103 104 105 106 107 108 109 10A 10B 10C 10D 10E 10F 110 111 112 116 ps6000pg.en r9 PICO_SIGGEN_WAVEFORM_SETUP_FAILED - A problem occurred in ps6000SetSigGenBuiltIn or ps6000SetSigGenArbitrary. PICO_FPGA_FAIL PICO_POWER_MANAGER PICO_INVALID_ANALOGUE_OFFSET - An impossible analogue offset value was specified in ps6000SetChannel. PICO_PLL_LOCK_FAILED - Unable to configure the PicoScope 6000.
PicoScope 6000 Series Programmer's Guide 117 118 119 11A 11B 11C 11D 11F 120 121 122 93 PICO_ETS_NOT_AVAILABLE_WITH_LOGIC_CHANNELS - When a digital port is enabled, ETS sample mode is not available for use. PICO_WARNING_REPEAT_VALUE - Not applicable to this device. PICO_POWER_SUPPLY_CONNECTED - The DC power supply is connected. PICO_POWER_SUPPLY_NOT_CONNECTED - The DC power supply isn’t connected. PICO_POWER_SUPPLY_REQUEST_INVALID - Incorrect power mode passed for current power source.
94 3.12 Programming with the PicoScope 6000 Series Enumerated types and constants Here are the enumerated types used in the PicoScope 6000 Series SDK, as defined in the file ps6000Api.h . We recommend that you refer to these constants by name unless your programming language allows only numerical values.
PicoScope 6000 Series Programmer's Guide } 95 PS6000_200MV, PS6000_500MV, PS6000_1V, PS6000_2V, PS6000_5V, PS6000_10V, PS6000_20V, PS6000_50V, PS6000_MAX_RANGES PS6000_RANGE; typedef enum enPS6000Coupling { PS6000_AC, PS6000_DC_1M, PS6000_DC_50R } PS6000_COUPLING; typedef enum enPS6000EtsMode { PS6000_ETS_OFF, PS6000_ETS_FAST, PS6000_ETS_SLOW, PS6000_ETS_MODES_MAX } PS6000_ETS_MODE; typedef enum enPS6000TimeUnits { PS6000_FS, PS6000_PS, PS6000_NS, PS6000_US, PS6000_MS, PS6000_S, PS6000_MAX_TIME_UNITS, }
96 Programming with the PicoScope 6000 Series PS6000_SIGGEN_GATE_HIGH, PS6000_SIGGEN_GATE_LOW } PS6000_SIGGEN_TRIG_TYPE; typedef enum enPS6000SigGenTrigSource { PS6000_SIGGEN_NONE, PS6000_SIGGEN_SCOPE_TRIG, PS6000_SIGGEN_AUX_IN, PS6000_SIGGEN_EXT_IN, PS6000_SIGGEN_SOFT_TRIG, PS6000_SIGGEN_TRIGGER_RAW } PS6000_SIGGEN_TRIG_SOURCE; typedef enum enPS6000IndexMode { PS6000_SINGLE, PS6000_DUAL, PS6000_QUAD, PS6000_MAX_INDEX_MODES } PS6000_INDEX_MODE; typedef enum enPS6000ThresholdMode { PS6000_LEVEL, PS6000_WIND
PicoScope 6000 Series Programmer's Guide 3.13 97 Numeric data types Here is a list of the sizes and ranges of the numeric data types used in the PicoScope 6000 Series API. Type short enum int long unsigned long float __int64 Bits 16 32 32 32 32 32 64 Copyright © 2009-2013 Pico Technology Ltd. All rights reserved. Signed or unsigned? signed enumerated signed signed unsigned signed (IEEE 754) unsigned ps6000pg.
98 4 Glossary Glossary Callback. A mechanism that the PicoScope 6000 driver uses to communicate asynchronously with your application. At design time, you add a function (a callback function) to your application to deal with captured data. At run time, when you request captured data from the driver, you also pass it a pointer to your function. The driver then returns control to your application, allowing it to perform other tasks until the data is ready.
PicoScope 6000 Series Programmer's Guide Index 99 Distribution 38 Downsampling 37 maximum ratio 28 modes A AC coupling Aggregation 57 17, 38 Analog offset Enabling channels 72 38 B Bandwidth limiter 57 Block mode 7, 8, 9 asynchronous call 9 callback Buffers overrun 46 22 86 25 26 ps6000GetAnalogueOffset 27 ps6000GetMaxDownSampleRatio ps6000GetNoOfCaptures 29 ps6000GetStreamingLatestValues 57 ps6000GetTimebase 31 ps6000GetTimebase2 32 ps6000GetTriggerTimeOffset 3 94 Contact details 3 Coupl
100 Index Functions ps6000OpenUnitProgress ps6000RunBlock O 52 53 One-shot signals 15 Opening a unit 50 checking progress ps6000RunStreaming 55 ps6000SetChannel 57 ps6000SetDataBuffer 60 ps6000SetDataBufferBulk 61 P 65 ps6000SetEtsTimeBuffers 66 ps6000SetExternalClock 67 ps6000SetNoOfCaptures 68 ps6000SetPulseWidthQualifier Pico Technical Support 69 PicoScope 6000 Series ps6000SetTriggerChannelConditions 78 ps6000SetTriggerChannelDirections ps6000SetTriggerChannelProperties ps6000SetTrigger
PicoScope 6000 Series Programmer's Guide 101 Visual Basic programming Voltage ranges 7 selecting 57 S Sampling rate maximum Scaling 87 8 7 Serial numbers 25 Signal generator 9 arbitrary waveforms 72 built-in waveforms software trigger 75 84 Software licence conditions Status codes 90 Stopping sampling 2 85 Streaming mode 7, 17 callback 86 getting number of samples retrieving data 49 30 running 55 using 17 Synchronising units System memory 20 4 System requirements 4 T Technical support T
PicoScope 6000 Series Programmer's Guide Copyright © 2009-2013 Pico Technology Ltd. All rights reserved. 103 ps6000pg.
Pico Technology James House Colmworth Business Park ST. NEOTS Cambridgeshire PE19 8YP United Kingdom Tel: +44 (0) 1480 396 395 Fax: +44 (0) 1480 396 296 www.picotech.com ps6000pg.en r9 02.09.13 Copyright © 2009-2013 Pico Technology Ltd. All rights reserved.