> 19.9 | AT^SRADC Configure and Read ADC Measurement

> The AT^SRADC configures the parameters required for ADC measurement (Analog-to-Digital Converter) and returns the measurement result(s). The value(s) can be delivered once on request by using the single measurement mode, or periodically by specifying the measurement interval.
> Note that the TC65 Module uses an unbalanced input with two pins, while the TC65 Terminal has a balanced input with four pins. This requires different pin names as listed below. See also [2] and [3].
> First ADC channel of TC65 Module: ADC1_IN.
> Second ADC channel of TC65 Module: ADC2_IN.
> First ADC channel of TC65 Terminal: ADC1_IN_P and ADC1_IN_N
> Second ADC channel of TC65 Terminal: ADC2_IN_P and ADC2_IN_N
> Another major difference between both products is that the TC65 Terminal requires the measured ADC voltages to be recalculated. For detail see parameter <value> below as well as the AT^SAADC command.
> Syntax

> Test Command AT^SRADC=?
> Response(s)
> ^SRADC:(list of supported <ch>s), (list of supported <oc>s), (list of supported <it>s)
> OK

> Read Command AT^SRADC?
> Response(s)
> Current settings of first and second ADC channel:
> ^SRADC: <ch>, <oc>, <it>
> ^SRADC: <ch>, <oc>, <it>
> OK

> Write Command Single measurement. Implies automatic channel open and close (<oc>=1 and 0) and no interval (<it>=0). AT^SRADC=<ch>
> Response(s)
> ^SRADC: <ch>, <count>, <value>
> OK
> ERROR
> +CME ERROR: <err>

> Write Command Periodic measurement. Requires <oc>=1 and <it>=100ms...30000ms AT^SRADC=<ch>, <oc>, <it>
> Response(s)
> ERROR
> +CME ERROR: <err>

> Reference(s) |  | PIN |  | ASC0 | ASC1 | USB | MUX1 | MUX2 | MUX3 |  |  | Charge | Q | Last
> SIEMENS |  | - |  | + | + | + | + | + | + |  |  | - | + | -

> Unsolicited Result Code
> URC indicating the used channel, the number of measured samples and the voltage. Applies only if periodic measurement mode is enabled.
> ^SRADC: <ch>, <count>, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>[, <value>]]]]]]]]]]
> Parameter Description

> <ch>(num)

> Select ADC channel
> 0
> First ADC channel
> (ADC1_IN at TC65 Module.ADC1_IN_P and ADC1_IN_N at TC65 Terminal.)
> 1
> Second ADC channel
> (ADC2_IN at TC65 Module.ADC2_IN_P and ADC2_IN_N at TC65 Terminal.)

> <oc>(num)

> Open or close ADC channel
> [0]
> Close ADC channel specified with <ch>
> 1
> Open ADC channel specified with <ch>

> <it>(num)

> Measurement interval
> [0]
> Single measurement mode
> 100...30,000
> Output interval in ms at steps of 60/13 ms to enable periodic measurement mode.

> <value>(num)

> Measurement value
> -25...+2425
> Measured voltage in mV
> Resolution: 1mV for TC65 Module resp. 2.083mV for TC65 Terminal
> Accuracy (typ.): 2mV for TC65 Module resp. 4mV for TC65 Terminal
> The captured value is the actual voltage applied at the ADCx_IN input. No further calculation is required.
> However, in the case of the TC65 Terminal, the captured value is a raw value. The exact voltage measured at the ADCx_IN_P and ADCx_IN_N inputs needs to be recalculated using the values obtained with AT^SAADC. See AT^SAADC for detail.

> <count>(num)

> 1...11
> Number of measured samples
> In single measurement mode: <count> is always 1.
> In periodic measurement mode: <count> is number of <value>s indicated by each URC "^SRADC". The higher the sample rate set with <it>, the more measured values are reported within the URC "^SRADC".
> Notes

> • | If power saving is enabled with AT+CFUN, take into account that the periodic mode lets the ME consume current each time the measurement is performed. This reduces the effect of power saving and thus decreases the operation time.

> • | If an AT command is input on the same interface where the periodic measurement mode is on, up to 5 "^SRADC" URCs are queued up and sent after AT command completion. If more than 5 URCs occur before the AT command is completed their measurement values are lost. In this case, one additional URC with a negative <count> and the single value "32767" is sent along with the first 5 buffered URCs. The negative <count> indicates the number of lost measurement values (not the number of URCs). See example below.

> Examples

> EXAMPLE 1 | Single measurement

> AT^SRADC=0 | Open the first ADC channel for single measurement.
> ^SRADC: 0,1,2375
> OK

> EXAMPLE 2 | Periodic measurement at low sample rate (5s):

> AT^SRADC=0,1,5000 | Start periodic measurement mode on the first ADC channel. Samples are taken every 5s. Every 5s the URC "^SRADC" appears to report the measured voltages. The second parameter represents the number of measured samples, in this case only one.
> ^SRADC: 0,1,2375
> ^SRADC: 0,1,2375
> ^SRADC: 0,1,2375.
> ^SRADC: 0,1,2375AT^SRADC=0,0 | Stop the periodic measurement.
> OK

> EXAMPLE 3 | Periodic measurement at high sample rate (250ms):

> AT^SRADC=0,1,250 | Start periodic measurement on the first ADC channel. Samples are taken every 250ms. Every second a URC "^SRADC" appears to report the measured voltage. The number of samples is 4 or 5.
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,5,2375,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375AT^SRADC=0,0
> OK | Stop the periodic measurement.

> EXAMPLE 4 | Handling of "^SRADC" URCs and AT command execution on the same interface:

> AT^SRADC=0,1,250 | Start periodic measurement mode on the first ADC channel. Samples are taken every 250ms.
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,5,2375,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375AT^SRADC? | Input of AT command and <CR> takes 4s.
> ^SRADC: 0,1,250
> ^SRADC: 1,0,0
> OK
> ^SRADC: 0,4,2375,2375,2375,2375 | 4 URCs were buffered during command input and sent after completion.
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375 | More URCs are delivered.
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375AT^SRADC? | Input of AT command and <CR> takes 7s.
> ^SRADC: 0,1,250
> ^SRADC: 1,0,0
> OK
> ^SRADC: 0,4,2375,2375,2375,2375 | 5 URCs were buffered during command input and sent after completion, another 2 URCs are lost.
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,4,2375,2375,2375,2375
> ^SRADC: 0,-8,32767 | The URC indicates 8 lost measurement results.
> ^SRADC: 0,4,2375,2375,2375,2375 | More URCs are delivered.
> ^SRADC: 0,4,2375,2375,2375,2375
> ......