PICO ADC-20 Manual

Programmer's Guide
adc20.en r1
High-Resolution Data Loggers
ADC-20/ADC-24

Contents
I
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved.adc20.en r1
Contents
1 Overview .............................................................................................................................. 1
2 Notices ................................................................................................................................ 2
1 Legal information ................................................................................................................................... 2
2 Trademarks ............................................................................................................................................ 2
3 Getting started .................................................................................................................... 3
1 Installing the software ........................................................................................................................... 3
2 Connecting the data logger .................................................................................................................. 3
4 Concepts ............................................................................................................................. 4
1 Recording methods ................................................................................................................................ 4
2 Windows driver ....................................................................................................................................... 4
3 Scaling .................................................................................................................................................... 4
5 Driver functions .................................................................................................................. 5
1 HRDLCloseUnit – shuts down unit ........................................................................................................ 6
2 HRDLCollectSingleValueAsync – sample a single value, non-blocking .............................................. 7
3 HRDLGetMinMaxAdcCounts – return the maximum and minimum ADC count ................................ 8
4 HRDLGetNumberOfEnabledChannels – return the number of analog channels enabled ................. 9
5 HRDLGetSingleValue – take one sample for the specified channel ................................................. 10
6 HRDLGetSingleValueAsync – retrieves reading after call to HRDLCollectSingleValueAsync() ...... 11
7 HRDLGetTimesAndValues – return time-stamped samples ............................................................ 13
8 HRDLGetUnitInfo – returns unit information as character string ...................................................... 14
9 HRDLGetValues – return samples for each enabled channel ........................................................... 16
10 HRDLOpenUnit – open a data logger ................................................................................................ 17
11 HRDLOpenUnitAsync – open a unit without blocking the calling thread ........................................ 18
12 HRDLOpenUnitProgress – check progress of an asynchronous open operation .......................... 19
13 HRDLReady – find out if readings are ready to be collected ........................................................... 20
14 HRDLRun – start sampling ............................................................................................................... 21
15 HRDLSetAnalogInChannel – enable or disable an analog channel ................................................ 22
16 HRDLSetDigitalIOChannel – set a digital output or input (ADC-24 only) ........................................ 23
17 HRDLSetInterval – set the sampling time interval ........................................................................... 25
18 HRDLSetMains – set the mains noise rejection frequency ............................................................. 26
19 HRDLStop – stop the device when streaming ................................................................................. 27
6 Sequence of calls and data flow ..................................................................................... 28
1 Streaming recording methods ............................................................................................................. 28
1 Collecting a block of data ........................................................................................................ 28
2 Collecting windowed or streaming data ................................................................................. 29
2 Single-value recording methods .......................................................................................................... 30
1 Collecting a single reading, blocking ...................................................................................... 30
2 Collecting a single reading, non-blocking ............................................................................... 30
7 Glossary ............................................................................................................................ 31

ADC-20/ADC-24 Programmer's Guide 1
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved. adc20.en r1
1 Overview
The ADC-20 and ADC-24 High-Resolution Data Loggers are multichannel, high-accuracy USB data
loggers for use with PCs. They require no external power supply.
We provide 32-bit and 64-bit Windows drivers to allow you to control the data loggers from your
own software. These drivers are included in the PicoSDK package, which you can download from
www.picotech.com/downloads.
Example code in a variety of programming languages can be downloaded from the "picotech"
organization on GitHub.
The hardware and software are compatible with Microsoft Windows 7, 8 and 10.

Notices2
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved.adc20.en r1
2 Notices
2.1 Legal information
The material contained in this release is licensed, not sold. Pico Technology Limited 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 Limited claims the copyright of, and retains the rights to, all material
(software, documents etc.) contained in this release. You may copy and distribute the entire
release in its original state, but must not copy individual items within the release other than for
backup purposes.
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
usage in mission-critical applications, such as 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.
2.2 Trademarks
Pico Technology Limited and PicoLog are trademarks of Pico Technology Limited, registered in
the United Kingdom and other countries.
PicoLog and Pico Technology are registered in the U.S. Patent and Trademark Office.
Windows and Excel are registered trademarks of Microsoft Corporation in the USA and other
countries.

ADC-20/ADC-24 Programmer's Guide 3
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved. adc20.en r1
3 Getting started
3.1 Installing the software
Before you connect the ADC-20 or ADC-24 to your computer for the first time, you must install the
driver using PicoSDK. You can download 32-bit and 64-bit versions of PicoSDK from
www.picotech.com/downloads.
3.2 Connecting the data logger
When you have installed the driver, connect the data logger's USB cable to a spare USB port on
your computer and wait until Windows displays the message "Device is ready to use".

Concepts4
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved.adc20.en r1
4 Concepts
4.1 Recording methods
The ADC-20/ADC-24 driver provides three methods of recording data. All these methods support
USB 1.1 and later.
·
Streaming. The driver constantly polls the device, and samples are placed in a buffer until
retrieved by your application. Precise sample timing is controlled by the unit.
·
Single value (blocking). You make a single request for a sample, blocking the calling thread, and
when the sample has been received the driver returns the value to your application.
·
Single value (non-blocking). You make a single request for a sample without blocking the calling
thread, and when the sample has been received the driver returns the value to your application.
4.2 Windows driver
The picohrdl.dll dynamic link library (DLL) in the lib subdirectory of your SDK installation is a
driver that allows you to program your ADC-20 or ADC-24 data logger. It is supplied in 32-bit and
64-bit versions. The driver exports the 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. It can also be used with programs like Microsoft Excel. The driver supports
Windows 7, 8 and 10.
4.3 Scaling
To convert from ADC values to volts, first obtain the minimum and maximum ADC values for the
selected channel by calling HRDLGetMinMaxAdcCounts() in the driver. Next, scale the ADC
value to the voltage range you specified when you called HRDLSetAnalogInChannel(). You can
calculate the voltage range programmatically by using
Vmax = 2500 mV / (2^r)
where ris the range constant you supplied to HRDLSetAnalogInChannel() (0 for ±2500 mV, 1
for ±1250 mV and so on).
You can then use Vmax to calculate the scaled voltage, V, with the following formula
V = (raw_ADC_value / max_ADC_Value) * Vmax
where raw_ADC_value is the reading from the device and max_ADC_value is the max ADC value for
the device obtained from HRDLGetMinMaxAdcCounts().

ADC-20/ADC-24 Programmer's Guide 5
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved. adc20.en r1
5 Driver functions
The following sections describe the functions available to an application using the ADC-20 and
ADC-24. All functions are C functions using the standard call naming convention (__stdcall) and
are exported with both decorated and undecorated names.

Driver functions6
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved.adc20.en r1
5.1 HRDLCloseUnit – shuts down unit
int16_t HRDLCloseUnit
(int16_t handle
)
Shuts down an ADC-20 or ADC-24 device.
Arguments
handle, device identifier returned by HRDLOpenUnit()
Returns
1 if a valid handle is passed
0 if not

ADC-20/ADC-24 Programmer's Guide 7
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved. adc20.en r1
5.2 HRDLCollectSingleValueAsync – sample a single value, non-blocking
int16_t HRDLCollectSingleValueAsync
(int16_t handle,
int16_t channel,
int16_t range,
int16_t conversionTime,
int16_t singleEnded
)
This function starts the unit sampling one value without blocking the calling application's flow.
Used in conjunction with HRDLGetSingleValueAsync() and HRDLReady().
Arguments
handle, device identifier returned by HRDLOpenUnit()
channel, Channel number to convert. If the channel is not valid then the function will fail.
range, The voltage range to be used. If the range is not valid, the function
HRDLGetSingleValueAsync() will return 0.
conversionTime, The time interval in which the sample should be converted. If the conversion
time is invalid, the function HRDLGetSingleValueAsync() will fail and return 0.
singleEnded, The type of voltage to be measured:
0: differential
<>0: single-ended
Returns
1 if a valid handle is passed and the settings are correct
0 if not

Driver functions8
Copyright © 2005–2019 Pico Technology Ltd. All rights reserved.adc20.en r1
5.3 HRDLGetMinMaxAdcCounts – return the maximum and minimum
ADC count
int16_t HRDLGetMinMaxAdcCounts
(int16_t handle,
int32_t * minAdc,
int32_t * maxAdc,
int16_t channel
)
This function returns the maximum and minimum ADC count available for the device referenced by
handle.
Arguments
·
handle, device identifier returned by HRDLOpenUnit()
·
minAdc, Pointer to an int32_t, used to return the minimum ADC count available for the unit
referred to by handle
·
maxAdc, Pointer to an int32_t, used to return the maximum ADC count available for the unit
referred to by handle
·
channel, Channel number for which maximum and minimum ADC count are required
Returns
1 if a valid handle is passed
0 if not
Otros manuales para ADC-20
1
Este manual sirve para los siguientes modelos
1
Tabla de contenidos
Otros manuales de Registrador de datos de PICO

PICO
PICO PicoLog CM3 Manual

PICO
PICO ADC-20 Manual de usuario

PICO
PICO picolog 1000 series Manual de usuario

PICO
PICO ADC-11/10 Manual de usuario

PICO
PICO DrDAQ Manual

PICO
PICO PicoLog CM3 Manual de usuario

PICO
PICO picolog 1000 series Manual de usuario

PICO
PICO USB TC-08 Manual de usuario

PICO
PICO DrDAQ Manual de usuario

PICO
PICO PicoLog CM3 Manual

















