background image

Programmer's Guide

ps2000pg.en-12

PC Oscilloscopes

PicoScope

®

 2000 Series

Содержание PicoScope 2000 Series

Страница 1: ...Programmer s Guide ps2000pg en 12 PC Oscilloscopes PicoScope 2000 Series ...

Страница 2: ......

Страница 3: ... 1 Using block mode 11 2 Streaming mode 13 1 Compatible streaming mode 13 2 Fast streaming mode 14 3 ETS Equivalent Time Sampling mode 15 1 Using ETS mode 15 4 Combining several oscilloscopes 16 5 API Functions 17 1 ps2000_close_unit 18 2 ps2000_flash_led 19 3 ps2000_get_streaming_last_values 20 4 ps2000_get_streaming_values 21 5 ps2000_get_streaming_values_no_aggregation 23 6 ps2000_get_timebase ...

Страница 4: ...lDirections 42 22 ps2000SetAdvTriggerChannelProperties 43 1 PS2000_TRIGGER_CHANNEL_PROPERTIES structure 44 23 ps2000SetAdvTriggerDelay 45 24 ps2000_set_channel 46 25 ps2000_set_ets 47 26 ps2000_set_light 48 27 ps2000_set_led 49 28 ps2000SetPulseWidthQualifier 50 1 PS2000_PWQ_CONDITIONS structure 51 29 ps2000_set_sig_gen_arbitrary 52 30 ps2000_set_sig_gen_built_in 54 31 ps2000_set_trigger 56 32 ps2...

Страница 5: ...Pico Technology software development kit SDK is available on the Pico Technology Software and Reference CD ROM and for free download from www picotech com downloads 1 2 Minimum system requirements To ensure that your PicoScope 2000 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 ...

Страница 6: ...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 applic...

Страница 7: ... 1 5 Warranty Pico Technology warrants upon delivery and for a period of 5 years unless otherwise stated from the date of delivery that the Goods will be free from defects in material and workmanship Pico Technology shall not be liable for a breach of the warranty if the defect has been caused by fair wear and tear willful damage negligence abnormal working conditions or failure to follow Pico Tec...

Страница 8: ...cope 2000 API driver called ps2000 dll which is supplied in 32 bit and 64 bit versions The driver exports the ps2000 function definitions in standard C format but this does not limit you to programming in C You can use the API with any programming language that supports standard C calls The API driver depends on a low level driver called WinUsb sys supplied in 32 bit and 64 bit versions which is i...

Страница 9: ...dvanced triggering modes Applicability Available in block mode and fast streaming mode only Calls to the ps2000_set_trigger and ps2000SetAdvTriggerChannelConditions functions have no effect in compatible streaming mode The triggering methods available for your oscilloscope are listed in the data sheet Where available the pulse width delay and drop out triggering methods additionally require the us...

Страница 10: ...ling rates less than the maximum it is possible to oversample Oversampling is taking more than one measurement during a time interval and returning an average If the signal contains a small amount of noise this technique can increase the effective vertical resolution of the oscilloscope by the amount given by the equation below Increase in resolution bits log oversample log 4 Applicability Availab...

Страница 11: ...data in 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 The maximum number of values depends upon the size of the oscilloscope s memory A PicoScope 2000 Series oscilloscope can sample at a number of different rates that correspond to the maximum sampling rate divided...

Страница 12: ...loscope using ps2000_get_values or ps2000_get_times_and_values 8 Display the data 9 Repeat steps 5 to 8 10 Stop the oscilloscope using ps2000_stop 11 Close the device using ps2000_close_unit Note that if you call ps2000_get_values ps2000_get_times_and_values or ps2000_stop before the oscilloscope is ready no capture will be available and the driver will not return any samples ...

Страница 13: ...samples is returned where the oldest samples may have already been returned before Windowed mode is useful when the program requires a constant time period of data Once the oscilloscope is collecting data in compatible streaming mode any setup changes for example changing a channel range or AC DC setting will cause a restart of the data stream The driver can buffer up to 32 kilosamples of data per...

Страница 14: ...ng mode for programming details 3 2 2 1 Using fast streaming mode This is the general procedure for reading and displaying data in fast streaming mode 1 Open the oscilloscope using ps2000_open_unit 2 Select channel ranges and AC DC coupling using ps2000_set_channel 3 Set the trigger using ps2000_set_trigger 4 Start the oscilloscope running using ps2000_run_streaming_ns 5 Get a block of data from t...

Страница 15: ...104 2105 2203 2204 2204A 2205 and 2205A oscilloscopes As ETS returns random time intervals the ps2000_get_times_and_values function must be used The ps2000_get_values function will return FALSE 0 Stable repetitive signals only 3 3 1 Using ETS mode This is the general procedure for reading and displaying data in ETS mode 1 Open the oscilloscope using ps2000_open_unit 2 Select channel ranges and AC ...

Страница 16: ...ndle for each oscilloscope All the other functions require this handle for oscilloscope identification For example to collect data from two oscilloscopes at the same time handle1 ps2000_open_unit handle2 ps2000_open_unit ps2000_set_channel handle1 set up unit 1 ps2000_run_block handle1 ps2000_set_channel handle2 set up unit 2 ps2000_run_block handle2 ready FALSE while not ready ready ps2000_ready ...

Страница 17: ...info ps2000_get_values ps2000_last_button_press ps2000_open_unit ps2000_open_unit_async ps2000_open_unit_progress ps2000_overview_buffer_status ps2000PingUnit ps2000_ready ps2000_run_block ps2000_run_streaming ps2000_run_streaming_ns ps2000SetAdvTriggerChannelConditions ps2000SetAdvTriggerChannelDirections ps2000SetAdvTriggerChannelProperties ps2000SetAdvTriggerDelay ps2000_set_channel ps2000_set_...

Страница 18: ... Programmer s Guide 5 1 ps2000_close_unit int16_t ps2000_close_unit int16_t handle Shuts down a PicoScope 2000 Series oscilloscope Applicability All modes Arguments handle the handle returned by ps2000_open_unit of the oscilloscope being closed Returns non zero if a valid handle is passed 0 if handle is not valid ...

Страница 19: ...t16_t ps2000_flash_led int16_t handle Flashes the LED on the front of the oscilloscope or in the pushbutton for the PicoScope 2104 and 2105 oscilloscopes three times and returns within one second Applicability All modes Arguments handle the handle of the PicoScope 2000 Series oscilloscope Returns non zero if a valid handle is passed 0 if handle is invalid ...

Страница 20: ..._run_streaming_ns beforehand to set up fast streaming Applicability Fast streaming mode only PicoScope 2202 2203 2204 2204A 2205 and 2205A only Not compatible with ETS triggering Function has no effect in ETS mode Arguments handle the handle of the required oscilloscope lpGetOverviewBuffersMaxMin a pointer to the my_get_overview_buffers callback function in your application that receives data from...

Страница 21: ...data in fast streaming mode It allows you to retrieve data with different aggregation ratios and thus zoom in to and out of any region of the data Before calling this function first capture some data in fast streaming mode stop fast streaming by calling ps2000_stop then allocate sufficient buffer space to receive the requested data The function will store the data in your buffer with values in the...

Страница 22: ...erflow on exit the function writes a bit field here indicating whether the voltage on each of the input channels has overflowed Bit 0 Ch A overflow Bit 1 Ch B overflow triggerAt on exit the function writes an index value here This is the offset from the start of the buffer of the sample at the trigger reference point It is valid only when triggered is TRUE triggered a pointer to a Boolean indicati...

Страница 23: ...igger uint32_t no_of_values This function retrieves raw streaming data from the driver s data store after fast streaming has stopped Before calling the function capture some data using fast streaming stop streaming using ps2000_stop and then allocate sufficient buffer space to receive the requested data The function will store the data in your buffer with values in the range PS2000_MIN_VALUE to PS...

Страница 24: ...scopes and B two channel scopes only pbuffer_c pbuffer_d not used overflow on exit the function will write a bit field here indicating whether the voltage on each of the input channels has overflowed Bit 0 is the LSB The bit assignments are as follows Bit 0 Ch A overflow Bit 1 Ch B overflow triggerAt on exit the function writes an index into the buffers here The index is the number of the sample a...

Страница 25: ...samples the number of samples that you require The function uses this value to calculate the most suitable time unit to use time_interval on exit this location will contain the time interval in nanoseconds between readings at the selected timebase If time_interval is NULL the function will write nothing time_units on exit this location will contain an enumerated type indicating the most suitable u...

Страница 26: ...ndle int32_t times int16_t buffer_a int16_t buffer_b int16_t buffer_c int16_t buffer_d int16_t overflow int16_t time_units int32_t no_of_values This function is used to get values and times in block mode after calling ps2000_run_block Note that if you are using block mode or ETS mode and call this function before the oscilloscope is ready no capture will be available and the driver will not return...

Страница 27: ...from that channel If a pointer is NULL nothing will be written to it buffer_c buffer_d not used overflow a bit pattern indicating whether an overflow has occurred and if so on which channel Bit 0 is the LSB The bit assignments are as follows Bit 0 Ch A overflow Bit 1 Ch B overflow time_units can be one of the following PS2000_FS 0 femtoseconds PS2000_PS 1 picoseconds PS2000_NS 2 nanoseconds defaul...

Страница 28: ...aracter string buffer If the string is not long enough to accept all of the information only the first string_length characters are returned line a value selected from enumerated type PS2000_INFO see table below specifying what information is required from the driver Returns The length of the string written to the string buffer 0 if one of the parameters is out of range or string is NULL PS2000_IN...

Страница 29: ...es_and_values instead Do not use in fast streaming mode Use ps2000_get_streaming_last_values instead Arguments handle the handle of the required oscilloscope buffer_a buffer_b pointers to the buffers that receive data from the specified channels A and B A pointer is not used if the oscilloscope is not collecting data from that channel If a pointer is NULL nothing will be written to it buffer_c buf...

Страница 30: ...ps2000_last_button_press int16_t handle This function returns the last registered state of the pushbutton on the PicoScope 2104 or 2105 PC Oscilloscope and then resets the status to zero Applicability PicoScope 2104 and 2105 only Arguments handle handle of the oscilloscope Returns 0 no button press registered 1 short button press registered 2 long button press registered ...

Страница 31: ...2000_open_unit void This function opens a PicoScope 2000 Series oscilloscope The driver can support up to 64 oscilloscopes Applicability All modes Arguments None Returns 1 if the oscilloscope fails to open 0 if no oscilloscope is found 0 oscilloscope handle if the oscilloscope opened Use this as the handle argument for all subsequent API calls for this oscilloscope ...

Страница 32: ...ries oscilloscope without waiting for the operation to finish You can find out when it has finished by periodically calling ps2000_open_unit_progress until that function returns a non zero value and a valid oscilloscope handle The driver can support up to 64 oscilloscopes Applicability All modes Arguments None Returns 0 if there is a previous open operation in progress non zero if the call has suc...

Страница 33: ..._async Arguments handle a pointer to where the function should store the handle of the opened oscilloscope 0 if no oscilloscope is found or the oscilloscope fails to open handle of oscilloscope valid only if function returns 1 progress_percent a pointer to an estimate of the progress towards opening the oscilloscope The function will write a value from 0 to 100 where 100 implies that the operation...

Страница 34: ...choose to increase the overview_buffer_size argument that you pass in the next call to ps2000_run_streaming_ns Applicability Fast streaming mode only PicoScope 2202 2203 2204 2204A 2205 and 2205A only Not compatible with ETS triggering function has no effect in ETS mode Arguments handle the handle of the required oscilloscope previous_buffer_overrun a pointer to a Boolean indicating whether the ov...

Страница 35: ...t ps2000PingUnit int16_t handle This function can be used to check that the already opened device is still connected to the USB port and communication is successful Applicability All modes Arguments handle the handle of the required device Returns 0 if function fails call ps2000_get_unit_info for further information Any non zero value communication successful ...

Страница 36: ...Block mode only Does nothing if the oscilloscope is in streaming mode Arguments handle the handle of the required oscilloscope Returns 0 if ready The oscilloscope has collected a complete block of data or the auto trigger timeout has been reached 0 if not ready An invalid handle was passed or the oscilloscope is in streaming mode or the oscilloscope is still collecting data in block mode 1 if the ...

Страница 37: ...le rate available timebase 1 selects a sample rate half as fast timebase 2 is half as fast again and so on For the maximum sample rate see the specifications for your oscilloscope The number of channels enabled may affect the availability of the fastest timebases oversample the oversampling factor a number between 1 and 256 See Oversampling for details time_indisposed_ms a pointer to the approxima...

Страница 38: ... much faster data transfer Applicability Only recommended for use with PicoScope 2104 and 2105 Arguments handle the handle of the required oscilloscope sample_interval_ms the time interval in milliseconds between data points This can be no shorter than 1 ms max_samples the maximum number of samples that the driver is to store This can be no greater than 60 000 It is the application s responsibilit...

Страница 39: ...amples the maximum number of samples that the driver should store from each channel Your computer must have enough physical memory for this many samples multiplied by the number of channels in use multiplied by the number of bytes per sample auto_stop a Boolean to indicate whether streaming should stop automatically when max_samples is reached Set to any non zero value for TRUE noOfSamplesPerAggre...

Страница 40: ...is defined by a PS2000_TRIGGER_CONDITIONS structure Applicability Available in block mode and fast streaming mode only PicoScope 2202 2204 2204A 2205 and 2205A only Arguments handle the handle of the required oscilloscope conditions a pointer to a PS2000_TRIGGER_CONDITIONS structure specifying the conditions that should be applied to the current trigger channel If NULL triggering is switched off n...

Страница 41: ...ach channel Use these constants CONDITION_DONT_CARE 0 CONDITION_TRUE 1 CONDITION_FALSE 2 channelC channelD not used external not used pulseWidthQualifier the type of condition to apply to the pulse width qualifier Choose from the same list of constants given under channelA channelB Remarks The channels that are set to CONDITION_TRUE or CONDITION_FALSE must all meet their conditions simultaneously ...

Страница 42: ...s through the threshold to activate the trigger The allowable values for a PS2000_THRESHOLD_DIRECTION variable are listed in the table below channelC channelD not used ext not used Returns 0 if unsuccessful or if one or more of the arguments are out of range non zero if successful PS2000_THRESHOLD_DIRECTION constants PS2000_ABOVE for gated triggers above a threshold PS2000_BELOW for gated triggers...

Страница 43: ...t streaming mode only PicoScope 2202 2204 2204A 2205 and 2205A only Arguments handle the handle of the required oscilloscope channelProperties a pointer to a PS2000_TRIGGER_CHANNEL_PROPERTIES structure describing the requested properties If NULL triggering is switched off nChannelProperties should be set to 1 if channelProperties is non null otherwise 0 autoTriggerMilliseconds the time in millisec...

Страница 44: ...OLD_MODE thresholdMode PS2000_TRIGGER_CHANNEL_PROPERTIES Applicability See ps2000SetAdvTriggerChannelProperties Members thresholdMajor the upper threshold at which the trigger event is to take place This is scaled in 16 bit ADC counts at the currently selected range for that channel thresholdMinor the lower threshold at which the trigger event is to take place This is scaled in 16 bit ADC counts a...

Страница 45: ...de only PicoScope 2202 2204 2204A 2205 and 2205A only Arguments handle the handle of the required oscilloscope delay the post trigger delay measured in sample periods This is the time between the trigger event and the sample at time t 0 For example at a timebase of 50 MS s or 20 ns per sample and with delay 100 the post trigger delay would be 100 20 ns 2 µ s Range 0 232 1 preTriggerDelay the locat...

Страница 46: ... channel an enumerated type specifying the channel Use PS2000_CHANNEL_A 0 or PS2000_CHANNEL_B 1 enabled specifies if the channel is active TRUE active FALSE inactive dc specifies the AC DC coupling mode TRUE DC coupling FALSE AC coupling range a code between 1 and 10 See the table below but note that each oscilloscope variant supports only a subset of these ranges Returns 0 if unsuccessful or if o...

Страница 47: ...ta which may contain data from previously returned cycles PS2000_ETS_SLOW 2 enables ETS and provides fresh data every ets_cycles cycles PS2000_ETS_SLOW takes longer to provide each data set but the data sets are more stable and unique ets_cycles the number of cycles to store The computer can then select ets_interleave cycles to give the most uniform spread of samples ets_cycles should be between t...

Страница 48: ...t int16_t handle int16_t state This function controls the white light that illuminates the probe tip on a handheld oscilloscope Applicability PicoScope 2104 and 2105 handheld oscilloscopes only Arguments handle handle of the oscilloscope state 0 light off 1 light on Returns 0 the function failed for example if a PicoScope 2000 Series oscilloscope was not found non zero success ...

Страница 49: ..._set_led int16_t handle int16_t state This function turns the LED on the oscilloscope on and off and controls its color Applicability PicoScope 2104 and 2105 handheld oscilloscopes only Arguments handle handle of the oscilloscope state 3 off 1 red 2 green Returns 0 the function failed for example if a PicoScope 2000 Series oscilloscope was not found non zero success ...

Страница 50: ...required oscilloscope conditions a pointer to a PS2000_PWQ_CONDITIONS structure specifying the conditions that should be applied to the trigger channel If conditions is NULL then the pulse width qualifier is not used nConditions should be set to 1 if conditions is non null otherwise 0 direction the direction of the signal required to trigger the pulse lower the lower limit of the pulse width count...

Страница 51: ...er conditions and is defined as follows typedef struct tPS2000PwqConditions PS2000_TRIGGER_STATE channelA PS2000_TRIGGER_STATE channelB PS2000_TRIGGER_STATE channelC PS2000_TRIGGER_STATE channelD PS2000_TRIGGER_STATE external PS2000_PWQ_CONDITIONS Applicability Pulse width qualified triggering Members channelA channelB the type of condition that should be applied to each channel Choose from these ...

Страница 52: ...cy and allowing the generation of lower frequencies The generator steps through the waveform by adding a deltaPhase value between 1 and phaseAccumulatorSize 1 to the phase accumulator every ddsPeriod 1 ddsFrequency If the deltaPhase is constant the generator produces a waveform at a constant frequency that can be calculated as follows outputFrequency ddsFrequency deltaPhase phaseAccumulatorSize aw...

Страница 53: ...ta phase value every time the dwellCount period expires This determines the amount by which the generator sweeps the output frequency in each dwell period dwellCount the time in multiples of ddsPeriod between successive additions of deltaPhaseIncrement to the delta phase counter This determines the rate at which the generator sweeps the output frequency arbitraryWaveform a pointer to a buffer that...

Страница 54: ...crovolts to be applied to the waveform pkToPk the peak to peak voltage in microvolts of the waveform signal waveType the type of waveform to be generated by the oscilloscope See the table below startFrequency the frequency at which the signal generator should begin For allowable values see ps2000 h stopFrequency the frequency at which the sweep should reverse direction or return to the start frequ...

Страница 55: ...00 Series Programmer s Guide waveType values PS2000_SINE sine wave PS2000_SQUARE square wave PS2000_TRIANGLE triangle wave PS2000_RAMPUP rising sawtooth PS2000_RAMPDOWN falling sawtooth PS2000_DC_VOLTAGE DC voltage PS2000_GAUSSIAN Gaussian PS2000_SINC sin x x PS2000_HALF_SINE half full wave rectified sine ...

Страница 56: ...e to look for a trigger Use PS2000_CHANNEL_A 0 PS2000_CHANNEL_B 1 or PS2000_NONE 5 The number of channels available depends on the oscilloscope threshold the threshold for the trigger event This is scaled in 16 bit ADC counts at the currently selected range direction use PS2000_RISING 0 or PS2000_FALLING 1 delay the delay as a percentage of the requested number of data points between the trigger e...

Страница 57: ... PS2000_CHANNEL_A 0 PS2000_CHANNEL_B 1 or PS2000_NONE 5 threshold the threshold for the trigger event This is scaled in 16 bit ADC counts at the currently selected range direction use PS2000_RISING 0 or PS2000_FALLING 1 delay specifies the delay as a percentage of the requested number of data points between the trigger event and the start of the block It should be in the range 100 to 100 Thus 0 me...

Страница 58: ...unction after the end of a capture to ensure that the scope is ready for the next capture When running the device in block mode or ETS mode you can call this function to interrupt data capture Note that if you are using block mode or ETS mode and call this function before the oscilloscope is ready no capture will be available and the driver will not return any samples Applicability All modes Argum...

Страница 59: ...es which then calls it back when the data is ready Your callback function should do nothing more than copy the data to another buffer within your application To maintain the best application performance the function should return as quickly as possible without attempting to process or display the data The function name my_get_overview_buffers is arbitrary When you write this function you can give ...

Страница 60: ...uffers 4 nValues Disabled channels return a null pointer resulting in four overview pointers whether all channels are enabled or not overviewBuffer 0 overviewBuffer 1 overviewBuffer 2 overviewBuffer 3 ch_a_max ch_a_min ch_b_max ch_b_min overflow a bit field that indicates whether there has been a voltage overflow and if so on which channel The bit assignments are as follows Bit 0 Ch A overflow Bit...

Страница 61: ...Technology Ltd All rights reserved ps2000pg en 12 PicoScope 2000 Series Programmer s Guide 6 Programming examples Your SDK installation includes programming examples in several languages and development environments Please refer to the SDK for details ...

Страница 62: ...o open more than PS2000_MAX_UNITS oscilloscopes 2 PS2000_MEM_FAIL Not enough memory could be allocated on the host machine 3 PS2000_NOT_FOUND An oscilloscope could not be found 4 PS2000_FW_FAIL Unable to download firmware 5 PS2000_NOT_RESPONDING The oscilloscope is not responding to commands from the PC 6 PS2000_CONFIG_FAIL The configuration information in the oscilloscope has become corrupt or is...

Страница 63: ...els Set the coupling mode using ps2000_set_channel Driver A piece of software that controls a hardware device The driver for the PicoScope 2000 Series PC Oscilloscopes is supplied in the form of a 32 bit Windows DLL which contains functions that you can call from your application ETS Equivalent time sampling Some PicoScope 2000 Series oscilloscopes can collect data over a number of cycles of a rep...

Страница 64: ...that is supplied to the driver to specify a sampling rate for the oscilloscope Each oscilloscope model has a different range of possible sampling frequencies as specified in the User s Guide for that model USB 1 1 An early version of the Universal Serial Bus standard found on older PCs Although your PicoScope will work with a USB 1 1 port it will operate much more slowly than with a USB 2 0 or 3 0...

Страница 65: ..._get_streaming_values 21 ps2000_get_streaming_values_no_aggregation 23 ps2000_get_timebase 25 ps2000_get_times_and_values 26 ps2000_get_unit_info 28 ps2000_get_values 29 ps2000_last_button_press 30 ps2000_open_unit 31 ps2000_open_unit_async 32 ps2000_open_unit_progress 33 ps2000_overview_buffer_status 34 ps2000_ready 36 ps2000_run_block 37 ps2000_run_streaming 38 ps2000_run_streaming_ns 39 ps2000_...

Страница 66: ...IONS structure 51 PS2000_THRESHOLD_DIRECTION constants 42 PS2000_TRIGGER_CHANNEL_PROPERTIES structure 44 PS2000_TRIGGER_CONDITIONS structure 41 R Real time continuous mode 64 Resolution vertical 10 S Sampling modes 11 Sampling rate 15 Signal generator 9 11 arbitrary waveforms 52 built in waveforms 54 Stopping sampling 58 Streaming mode 11 13 64 compatible 13 fast 14 normal 13 windowed 13 Sweep 9 S...

Страница 67: ......

Страница 68: ...d Tyler TX 75702 United States of America Pico Technology Room 2252 22 F Centro 568 Hengfeng Road Zhabei District Shanghai 200070 PR China sales picotech com support picotech com pico asia pacific picotech com Asia Pacific regional office Tel 44 0 1480 396 395 United States headquarters United Kingdom headquarters Tel 1 800 591 2796 Tel 86 21 2226 5152 www picotech com sales picotech com support p...

Отзывы: