Skip to Content

CXAIN Command - Analog Input Configuration

Configures the interpretation of magnitudes read by the device’s AD inputs, allowing transformation and scaling of values according to the application.


What is it for?

Use caseDescription
📊 Fuel sensorsConvert voltage to liters or percentage
🌡️ Temperature sensorsTransform analog signal to °C
Voltage measurementScale voltage readings
📈 Custom calibrationAdjust readings to specific units

  • It is recommended to recalibrate the analog reading constant through the AR Command
  • The AD value reading for each input can be obtained through the AIN Command
  • To query all readings obtained from all AD inputs of the device or generate a report with these values, use the AD Report

Commands

Configure

SCXAINaabccccdeeeefgggghiiiijkkkklmmmm

Query

QCXAINaa

Response

RCXAINaabccccdeeeefgggghiiiijkkkklmmmm

Parameters

FieldDescriptionRange
aaAnalog input index00, 01, 02, 07
bSign of lower output limit (BOTTOM)+ / -
ccccMagnitude of lower output limit (BOTTOM)00009999
dSign of upper output limit (TOP)+ / -
eeeeMagnitude of upper output limit (TOP)00009999
fSign of first calibration point voltage (XA)+ / -
ggggFirst calibration voltage XA in hundredths of a volt (0500 = 5.00 V)00009999
hSign of second calibration point voltage (XB)+ / -
iiiiSecond calibration voltage XB in hundredths of a volt (0500 = 5.00 V)00009999
jSign of output value at the first point (YA)+ / -
kkkkOutput value corresponding to XA (YA) — free unit00009999
lSign of output value at the second point (YB)+ / -
mmmmOutput value corresponding to XB (YB) — free unit00009999

How the reported value is computed

The device performs a linear interpolation between the two points (XA, YA) and (XB, YB) over the measured voltage, then clamps the output to the [BOTTOM, TOP] range:

Y = YA + (Vin − XA) · (YB − YA) / (XB − XA) output = clamp(Y, BOTTOM, TOP)
  • Vin is expressed in hundredths of a volt (same as XA and XB).
  • YA, YB, BOTTOM and TOP are in the output unit of your choice (liters, %, °C, mV, etc.).
  • The clamp ensures that voltages outside the calibrated range never produce nonsense values.

XA and XB are hundredths of a volt, not tenths. For example:

  • 0500 = 5.00 V
  • 1230 = 12.30 V
  • 3300 = 33.00 V

Mixing up the scale (writing 0050 thinking “5 V”) is the most common mistake when configuring this command.


Examples

Resistive fuel sensor 0–5 V → 0–100 %

Linear sensor whose output ranges from 0 V (empty tank) to 5 V (full tank).

>SCXAIN01+0000+0100+0000+0500+0000+0100< // aa = 01 → input AD1 // BOT = +0000 → lower output clamp = 0 % // TOP = +0100 → upper output clamp = 100 % // XA = +0000 → 0.00 V (empty tank) // XB = +0500 → 5.00 V (full tank) // YA = +0000 → 0 % // YB = +0100 → 100 %

Capacitive fuel sensor 0–33 V → 0–200 L

Higher-range sensor (common on trucks) that delivers up to 33 V for a 200-liter tank.

>SCXAIN01+0000+0200+0000+3300+0000+0200< // XA = 0.00 V → 0 L // XB = 33.00 V → 200 L // Output clamped to [0, 200] liters

Temperature sensor 0–5 V → −40 °C to +150 °C

Output with negative offset: at 0 V the sensor reports −40 °C; at 5 V it reports +150 °C.

>SCXAIN01-0040+0150+0000+0500-0040+0150< // BOT = -0040 → minimum reported = −40 °C // TOP = +0150 → maximum reported = +150 °C // XA = +0000 → 0.00 V → YA = -0040 (−40 °C) // XB = +0500 → 5.00 V → YB = +0150 (+150 °C)

Direct battery reading 0–36 V

Identity mapping in hundredths of a volt: the output equals the voltage (1245 → 12.45 V).

>SCXAIN01+0000+3600+0000+3600+0000+3600< // XA = 0.00 V → YA = 0 // XB = 36.00 V → YB = 3600 // Output clamped to [0, 3600] (hundredths of a volt)

Passthrough — no transformation (raw ADC value)

Useful when you want to obtain the raw ADC reading with no scaling. This is the factory default.

>SCXAIN01-9999+9999-0000+0001-0000+0001< // Unit slope with clamp at [-9999, +9999] // Equivalent to applying no conversion

To query the current configuration of any input, use QCXAINaa. The device responds with an RCXAIN that has the exact same format as the SCXAIN previously sent:

>QCXAIN01< >RCXAIN01+0000+0100+0000+0500+0000+0100<

Compatibility

💾Firmware:v1.00.00
SPLegacy
ULLegacy
MTLegacy
C3Legacy
C5Legacy
SP-IOT
SM-IOT
ZE-IOT

See Also

Last updated