1 Legal information ................................................................................................................................... 2
2 Windows driver ....................................................................................................................................... 4
The ADC-20 and ADC-24 High-Resolution Data Loggers are multichannel, high-accuracy USBdata
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.
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.
2.2
Viruses. This software was continuously monitored for viruses during production, but you are
responsible for virus-checking the software once it is installed.
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
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.
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".
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.
Windows driver
The picohrdl.dlldynamic 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.
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 r is 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().
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.
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
1if a valid handle is passed and the settings are correct
0if not
This function takes one sample for the specified channel at the selected voltage range and
conversion time.
Arguments
handle, device identifier returned by HRDLOpenUnit()
channel, The channel number to convert.
ADC-20: 1 to 8
ADC-24: 1 to 16
If the channel is not valid then the function will fail and return 0.
range, the voltage range to be used. See HRDLSetAnalogInChannel() for possible values. If
the range is not valid, the function will return 0.
conversionTime, The time interval in which the sample should be converted. See
HRDLSetInterval() for possible values. If the conversion time is invalid, the function will fail
and return 0.
singleEnded, The type of voltage to be measured.
0: differential
<>0: single-ended
overflow, pointer to a bit field that indicates when the voltage on a channel has exceeded the
upper or lower limits.
Bit 0: Channel 1
...
Bit 15: Channel 16
value, pointer to an int32_t where the ADC value will be written.
Returns
1if a valid handle is passed and settings are correct
0if not
If the function fails, call HRDLGetUnitInfo() with info = HRDL_ERROR (7) to obtain the
error code. If the error code is HRDL_SETTINGS (5), then call HRDLGetUnitInfo() again with
info = HRDL_SETTINGS_ERROR (8) to determine the settings error.
if(bConversionFinished==TRUE){// Do something with the valuechannelNo++;// This would be HRDL_ANALOG_IN_CHANNEL_8 for the ADC-20if(channelNo>HRDL_ANALOG_IN_CHANNEL_16){channelNo=HRDL_ANALOG_IN_CHANNEL_1;}}else{// Do something else while waiting for the reading from the unit}}
// Test to see if the conversion has finishedif(bStartedConversion){if(HRDLReady(handle)){HRDLGetSingleValueAsync(handle,lValue,&overflow);bConversionFinished=TRUE;bConversionStarted=FALSE;}}
// Test to see if no conversion is in progressif(!bStartedConversion){// Start the conversion goingbStartedConversion=HRDLCollectSingleValueAsync(handle,channel,range,conversionTime,singleEnded);bConversionFinished=TRUE;}
This function returns the requested number of samples for each enabled channel and the times
when the samples were taken, so the values array needs to be (number of values) x (number of
enabled channels). When one or more of the digital IOs are enabled as inputs, they count as one
additional channel. The function informs the user if the voltages for any of the enabled channels
have overflowed.
Arguments
handle, device identifier returned by HRDLOpenUnit()
times, pointer to an int32_t where times will be written
values, pointer to an int32_t where sample values will be written. If more than one channel is
active, the samples are interleaved. If digital channels are enabled then they are always the first
values. See table below for the order in which data are returned.
overflow, pointer to an int16_t indicating any inputs that have exceeded their maximum
voltage range. Channels with overvoltages are indicated by a high bit, with the LSB indicating
channel 1 and the MSB channel 16.
noOfValues, the number of samples to collect for each active channel.
Returns
A non-zero number if successful indicating the number of values returned,
0 if the call failed or no values available
Ordering of returned data (example)
When two analog channels (e.g. 1 and 5) are enabled and a digital channel is set as an input, the
data are returned in the following order:
Sample No: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 . n-3 n-2 n-1
Channel: DI 1 5 DI 1 5 DI 1 5 DI 1 5 DI 1 5 . DI 1 5
where n represents the value returned by the function and DI the digital inputs.
The channels are always ordered from channel 1 up to the maximum channel number (ADC-24:
channel 16, ADC-20: channel 8). If one or more digital channels are set as inputs then the first
sample contains the digital channels.
Digital inputs
The digital channels are represented by a binary bit pattern with 0 representing off, and 1
representing on. Digital input 1 is in bit 0.
HRDLGetUnitInfo – returns unit information as character string
int16_t HRDLGetUnitInfo
(
int16_t handle,
int8_t * string,
int16_t stringLength,
int16_t info
)
This function writes information about the ADC-20 or ADC-24 device to a character string. If the
logger fails to open, only info = HRDL_ERROR (7) is available to explain why the last open unit
call failed. When retrieving the driver version, the handle value is ignored.
Arguments
handle, identifier of the device from which information is required. If an invalid handle is passed,
the error code from the last unit that failed to open is returned (as if info = HRDL_ERROR),
unless info = HRDL_DRIVER_VERSION and then the driver version is returned.
string, pointer to the int8_t string buffer in the calling function where the unit information
string (selected with info) will be stored. If a null pointer is passed, no information will be written.
stringLength, Length of the int8_t string buffer. If the string is not long enough to accept all
of the information, only the first stringLength characters are returned.
info, Enumerated type (listed below) specifying what information is required from the driver.
Returns
The length of the string written to the int8_t string buffer, string, by the function.
If one of the parameters is out of range, or a null pointer is passed for string, the function will
return zero.
This function returns the requested number of samples for each enabled channel, so the size of
the values array needs to be (number of values) x (number of enabled channels). When one or
more of the digital IOs are enabled as inputs, they count as one additional channel. The function
informs the user if the voltages of any of the enabled channels have overflowed.
Arguments
handle, device identifier returned by HRDLOpenUnit()
values, pointer to an int32_t where the sample values are written. If more than one channel is
active, the samples are interleaved. If digital channels are enabled then they are always the first
value. See table below for the order in which data are returned.
overflow, pointer to an int16_t indicating any inputs that have exceeded their maximum
voltage range. Channels with overvoltages are indicated by a high bit, with the LSB indicating
channel 1 and the MSB channel 16.
noOfValues, the number of samples to collect for each active channel.
Returns
A non-zero number if successful indicating the number of values returned, or
0 if the call failed or no values available
Ordering of returned data (example)
When two analog channels (such as 1 and 5) are enabled and a digital channel is set as an input,
the data are returned in the following order.
Sample No: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 . n-3 n-2 n-1
Channel: DI 1 5 DI 1 5 DI 1 5 DI 1 5 DI 1 5 . DI 1 5
where n represents the total number of values returned by the function and DI the digital inputs.
The channels are always ordered from channel 1 up to the maximum channel number (ADC-24:
channel 16, ADC-20: channel 8). If one or more digital channels are set as inputs, and digital inputs
are enabled by calling HRDLSetDigitalIOChannel() with enabledDigitalIn=1, the first
sample in each group contains the digital channels.
Digital inputs
The digital channels are represented by a binary bit pattern with 0 representing off and 1
representing on. Digital input 1 is in bit 0.
This function enables or disables the selected analog channel. If you wish to enable an oddnumbered channel in differential mode, you must first make sure that its corresponding evennumbered channel is disabled. (For example, to set channel 1 to differential mode, first ensure that
channel 2 is disabled).
Arguments
handle, device identifier returned by HRDLOpenUnit()
channel, the channel that will be enabled or disabled.
ADC-20: 1 to 8
ADC-24: 1 to 16
enabled, sets the channel active or dormant:
0: dormant
<> 0: active
range, The voltage range to be used during sampling. Applies only to selected channel. See
Voltage ranges below.
singleEnded, non-zero to measure a single-ended voltage. Zero for a differential voltage.
Returns
0 if failed
1 if successful
If the function fails, call HRDLGetUnitInfo() with info = HRDL_SETTINGS_ERROR (8) to
obtain the specific settings error.
Configures the digital input/output channels of the ADC-24. If the direction is "output" then the pin
can be driven high or low. While the device is sampling, the direction cannot be changed but the
state can.
Applicability
ADC-24 only
Arguments
handle, device identifier returned by HRDLOpenUnit()
directionOut, the directions of the digital IO pins. Add up the HRDL_DIGITAL_IO_CHANNEL
constants (see below) for the pins that you want to be outputs. Any pins not configured as outputs
will become inputs.
digitalOutPinState, the states of the digital outputs. Add up the
HRDL_DIGITAL_IO_CHANNEL constants (see below) for the pins that you want to be high. Any
pins not defined as high will be driven low.
enabledDigitalIn, Sets the digital input as active. Use a combination of
HRDL_DIGITAL_IO_CHANNEL constants (see below). The ordering of returned data is described
under HRDLGetValues().
Returns
0 if failed,
1 if successful
If the function fails, call HRDLGetUnitInfo() with info = HRDL_SETTINGS_ERROR (8) to
obtain the specific setting error.
Pin values for directionOut and digitalOutPinState:
The above is a selection of the 16 different options available for the directionOut parameter.
When a digital channel has been configured as an output, it can then be driven high or low with the
digitalOutputPinState parameter, again using bit patterns to represent the different digital
channels.
The default setting for the digital channels is "output, low".
This function stops the device from sampling data.
When running the device in windowed or streaming mode, you will need to call this function to end
data collection. This is particularly important in streaming mode, to ensure that the scope is ready
for the next capture.
When running the device in block mode, you can call this function to interrupt data capture.
Arguments
handle, device identifier returned by HRDLOpenUnit()
The C sample program picohrdlCon.c demonstrates the use of all the functions of the API
driver, and includes examples showing each mode of operation. It is available from the picohrdl
subdirectory in the picotech/picosdk-c-examples repository on GitHub.
6.1
6.1.1
Streaming recording methods
Collecting a block of data
·
This method collects a single block of data and then stops.
·
Open the data logger with one of the HRDLOpenUnit() calls
·
Set mains noise rejection with HRDLSetMains()
·
Set the analog or/and digital channels
·
Set the sample interval with HRDLSetInterval()
·
Start the unit collecting samples by calling HRDLRun() with method = BM_BLOCK
·
Loop
·
·
·
·
Repeat Loop until ready (HRDLReady())
Collect data with HRDLGetValues()
Repeat from "Start the unit" until you have finished collecting data.
Close the connection to the unit with HRDLCloseUnit()
This method causes the device to start sampling. Samples are stored in the driver's buffer. In
windowed mode, the buffer will always contain the requested number of samples, but generally
only a subset of these are new data. In streaming mode, new data are returned continuously.
·
Open the data logger with one of the HRDLOpenUnit() calls
·
Set mains noise rejection with HRDLSetMains()
·
Set the analog or/and digital channels
·
Set the sample interval with HRDLSetInterval()
·
Start the unit collecting samples by calling HRDLRun() with method = BM_WINDOW or
BM_STREAM
·
Loop
·
·
·
·
Repeat Loop until ready (HRDLReady())
Collect data whenever you want with HRDLGetValues()
Call HRDLStop() to end data collection
Close the connection to the unit with HRDLCloseUnit()
Asynchronous. In asynchronous data collection, your application requests data from the driver,
and the driver immediately returns without blocking the application. The application must then poll
a status function until the data is ready.
Data logger. A measuring instrument that monitors one or more analog signals, samples them at
pre-programmed intervals, then accurately converts the samples to digital data and stores them in
memory. The ADC-20 and ADC-24 use your PC for storage and display.
DLL. Dynamic Link Library. A DLL is a file containing a collection of Windows functions designed to
perform a specific class of operations.
Driver. A driver is a computer program that acts as an interface, generally between a hardware
component and a computer system, the hardware in this case being the data logger.
LSB. Least significant bit. In a binary word, the least significant bit has the value 1.
MSB. Most significant bit. In an n-bit binary word, the most significant bit has the value 2
Noise rejection. The ability of the data logger to attenuate noise in a given frequency range. The
ADC-20/ADC-24 can be programmed to reject noise at either 50 hertz or 60 hertz. The noise
rejection ratio is defined as:
NRR(dB) = 20 log10 (Vin/Vmeas)
where NRR(dB) is the noise rejection ratio in decibels, Vin is the noise voltage at the input, and
Vmeas is the noise voltage that appears in the measurement.
USB. Universal Serial Bus. This is a standard port that enables you to connect external devices to
PCs. A full-speed USB 2.0 port operates at up to 480 megabits per second. The PicoLog 1000
Series is compatible with any USB port from USB 1.1 upwards.