BeRTOS
|
NTC hardware-specific definition. More...
Go to the source code of this file.
Functions | |
res_t | ntc_hw_read (NtcDev dev) |
const NtcHwInfo * | ntc_hw_getInfo (NtcDev dev) |
NTC hardware-specific definition.
A NTC acts as a variable resistor, whose resistance changes as a function of the temperature it measures. To sample it correctly, it is usually parallelized and serialized with two fixed resistor. The following diagram shows what is the exact disposition of the components, as handled by this library:
o Vref | | o Vref | | ----- | | | --------- | Rser| | | | | | | ----- ----- | ADC | | Vp | | | | -----------|------| Amp |-------------| | | | | | Vadc | | ----- ----- ----- --------- | | | | | NTC | | Rpar| | | | | ----- ----- | | | | ----- ----- --- --- *
Amp is an amplifier that amplify of AMP times the signal. If we indicate Rp as the parallel of NTC with Rpar, ADCBITS as the bits of the ad converter and ADCVAL as the result from the adc convertion (Not Vadc but just the value read from the adc register), after various calculation, the expression of Rp is:
ADCVAL * Rser Rp = ------------------------ ADCBITS 2 * AMP - ADCVAL *
And after that NTC obvisiously is:
Rpar * Rp NTC = ---------- Rpar - Rp *
The function ntc_hw_read() compute the resistence using these formulas above.
Definition in file hw_ntc.h.
const NtcHwInfo* ntc_hw_getInfo | ( | NtcDev | dev | ) | [inline] |