ADC components of OSS-EC
The ADC component of the OSS-EC is used as an example here. BSL00000057 is described as an example program.
- Block diagram of ADC components architecture and OSS-EC architecture ( fig 1. )
- ADC component state flow ( fig 2. )
- API ( fig 3. )
Blue label characters are data related to User-defined.
Green label characters are data related to model number.
BSL00000057 Features
– Component type | ADC component |
– Number of Components | Single |
– Supported OS (HAL) | Arduino |
– Calculation | Floating-point |
– Conversion type | Linear |
– Moving average filter | Moving average filter select ( Non,SMA,EMA,WMA ) |
– Diagnosis | Range (Min to Max) |
Example download
An example using NXP’s MPXA4250A can be downloaded below.

y | physical value |
ai | A/D conversion value |
vi | Sensor output voltage value |
Vdd | Sensor supply voltage(ADC_vdd) value |
ADC_bit | A/D conversion bit length |
PP | Package Program |
MP | Microcontroller unit program ADC unit program ai = f(ch) |
CP | Circuit/IC components program Conversion formula from circuit output voltage to sensor output signal value vi = f(ai) |
SP | System components program Conversion formula from sensor output signal value to physical value y = f(vi) |
The conversion formula for vi shall be as follows.
vi = f(ai) = ai * ADC_vdd / ( 2ADC_bit )
ADC_Vdd | Sensor supply voltage [V] |
ADC_bit | ADC conversion of MPU Bit number |
The conversion formula for y is as follows. ( Liner conversion )
Let it be a linear transformation equation.
y = f(vi) = ( vi – x_offset ) / gain + y_offset range min to max
x_offset | Sensor output voltage offset value [V] |
gain | Voltage value to physical value conversion gain |
y_offset | Physical offset value |
min | Physical value min |
max | Physical value max |
Software Option
Moving average select
#define | iMA | iSMA | Simple moving average filter phy = ( yn + yn-1 + yn-2 … ) / n n : iABCDEF_SMA_num |
#define | iMA | iEMA | Exponential moving average filter phy = ( y × k ) + ( phyn-1 × ( 1 – k ) ) k : iABCDEF_EMA_K |
#define | iMA | iWMA | Weighted moving average filter phy = ( ( yn × 1 ) + ( yn-1 × 2 ) + ( yn-2 × 3 ) … ) / ( 1 + 2 + 3 … ) n : iABCDEF_WMA_num |
#define | iMA | iNonMA | Non-moving average filter |


typedef struct | |||
{ | |||
uint32 | sts; | // Diagnosis result of range min to max | |
float32 | phy; | // Sensor physical value | |
}pp2ap_adc_t; |
sts Normal = iNormal, Over Max = iMax_NG, Under Min = iMin_NG