LevelMeter-Display  2.0
An ultrasonic Level Meter for Stormwater Cisterns
Functions
sensors.c File Reference

Routines for handling Sensor values. More...

Include dependency graph for sensors.c:

Functions

double P3FromADC (uint16_t val)
 Converts a P3-Raw ADC Value to Voltage. More...
 
double P5FromADC (uint16_t val)
 Converts a P5-Raw ADC Value to Voltage. More...
 
double SWUnregFromADC (uint16_t val)
 Converts a SWUnreg-Raw ADC Value to Voltage. More...
 
double TempFromADC (void)
 Converts the ADC-Temp Value to Celsius. More...
 
double UnregFromADC (uint16_t val)
 Converts a Unreg-Raw ADC Value to Voltage. More...
 

Detailed Description

Routines for handling Sensor values.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Function Documentation

◆ P3FromADC()

double P3FromADC ( uint16_t  val)

Converts a P3-Raw ADC Value to Voltage.

Note
The JTAGEN-Fuse has to be cleared to receive accurate values for P3 since the ADC4 (PORTF4) pin will source current while JTAG is enabled! The error may well exceed 15% FSR. This has to be done before the final calibration!
During debugging via JTAG, P3 is not measurable and Jumper X11 has to be disconnected for the voltage dividers not to interfere with the JTAG interface!
Parameters
valThe ADC Value
Returns
The Voltage

References config, and confStruct_t::P3VoltsPerLSB.

Referenced by CmdStat(), EnterDouble(), FTestSupply(), and ShowScreen().

Here is the caller graph for this function:

◆ P5FromADC()

double P5FromADC ( uint16_t  val)

Converts a P5-Raw ADC Value to Voltage.

Parameters
valThe ADC Value
Returns
The Voltage

References config, and confStruct_t::P5VoltsPerLSB.

Referenced by CmdStat(), EnterDouble(), FTestSupply(), ShowScreen(), and TempFromADC().

Here is the caller graph for this function:

◆ SWUnregFromADC()

double SWUnregFromADC ( uint16_t  val)

Converts a SWUnreg-Raw ADC Value to Voltage.

Parameters
valThe ADC Value
Returns
The Voltage

References config, and confStruct_t::SWUnregVoltsPerLSB.

Referenced by CmdStat(), EnterDouble(), FTestSWUnreg(), and ShowScreen().

Here is the caller graph for this function:

◆ TempFromADC()

double TempFromADC ( void  )

Converts the ADC-Temp Value to Celsius.

Note
This function takes extensive floating point operations and may thus block for about 400us.
Returns
The Temperature in Celsius

References ADCData_t::ADC_P5, ADCData_t::ADC_Temp, ADCData, ADCDataAvg, ADCData_t::named, and P5FromADC().

Referenced by CmdStat(), and ShowScreen().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregFromADC()

double UnregFromADC ( uint16_t  val)

Converts a Unreg-Raw ADC Value to Voltage.

Parameters
valThe ADC Value
Returns
The Voltage

References config, and confStruct_t::UnregVoltsPerLSB.

Referenced by CmdStat(), EnterDouble(), FTestSupply(), FTestSWUnreg(), main(), and ShowScreen().

Here is the caller graph for this function: