E.Sergeicheva, V.Zavjalov (vl.zavjalov at gmail dot com), 2019-2024
This is a simple C++ program which implements SPP interface to Pico ADC devices, for using with device2 server (https://github.com/slazav/device2)
libpicohrdl library is needed.
-l
-- list all connected devices and exit-d <dev>
-- device ID (autodetect by default)-m <Hz>
-- set mains frequency, Hz (50 or 60, default 50)-h
-- write this help message and exit
-
get_time
-- Get current time (unix seconds with ms precision). -
*idn?
-- Get ID string:pico_adc <version>
. -
help
-- Get list of commands. -
get_info
-- Get device information. -
ranges
-- Get available range settings (mV):2500 1250 625 312.5 156.25 78.125 39.0625
. -
tconvs
-- Get available conversion time settings (ms):60 100 180 340 660
-
get_val <chan> <single> <rng> <convt>
-- Measure a single value. This command do measurement of a single value on the channel<chan>
(1..16). Boolean parameter<single>
specifies single/differential mode. Only odd channels (1,3,5,...) can be used for differential mode, next channel number is used as the second channel. Parameter<rng>
is measurement range, one of values returned byranges
command.convt
is conversion time, one of values returned bytconvs
command. Use longer time for more accurate measurement. In the case of overflow +/-Inf is returned. -
set_dig_out <v1> <v2> <v3> <v4>
-- Set digital outputs. Using digital ports for input is not supported.
Commands listed below are used for "block read mode", to do measurement
of multiple channels. In this mode one should set channel parameters and
measurement timings in advance, and then do the measurement. Note that
real measurements are still done in series, channel by channel. If device
is used by multible users (e.g. with device2 server) then device locking
is needed during the measurement. It is not recommended to use
block read mode (use get_val
instead), and especially not recommended
to mix get_val
measurements with the block read measuremens.
-
chan_set <chs> <en> <sngl> <rng>
-- set channel parameters.chs
-- Channels: 01 to 16, multiple channels allowed.en
-- Enable channels: 1 or 0.sngl
-- Single/Differential mode: 1 or 0.rng
-- Input range, mV (seeranges
command).
-
disable_all
-- Disable all channels. Do this before setting up channels if the device was in unknown state. -
chan_get <ch>
-- get channel parameters (<ch> <en> <sngl> <rng>
, or<ch> disabled
for disabled channels. -
chan_get_n
-- get number of enabled analog channels. -
set_t <dt> <tconv>
-- Set timings. Parameterdt
is measurement time [ms]. If N is number of enabled channels then dt should be: Nconv_t < dt <= 1000Nconv_t. It makes sense only for block reads with multiple measurements which are not supported now. Set this to the smallest possible value (Nconv_t+1). Parameterconv_t
is ADC conversion time for a single value [ms]. Use longer times for more accurate measurements. -
get
-- collect and return a single data block. Returns one value for each enabled channel.chan_set
andset_t
should be done before. In case of overflow +/-Inf is returned;