LevelMeter-Display  2.0
An ultrasonic Level Meter for Stormwater Cisterns
Functions | Variables
adc - Kopie.c File Reference
Include dependency graph for adc - Kopie.c:

Functions

void InitADC (void)
 Initializes the ADC. More...
 
 ISR (ADC_vect)
 ADC Conversion Complete Interrupt. More...
 

Variables

volatile ADCData_t ADCData
 ADC-Values for the last measurement. More...
 
volatile ADCData_t ADCDataAvg
 Averaged ADC-Values. More...
 
volatile ADCData_t ADCDataMax
 Maximum ADC-Values during last average Period. More...
 
volatile ADCData_t ADCDataMaxTmp
 Maximum ADC-Values in the current Period. More...
 
volatile ADCData_t ADCDataMin
 Minimum ADC-Values during last average Period. More...
 
volatile ADCData_t ADCDataMinTmp
 Minimum ADC-Values in the current Period. More...
 
volatile uint8_t adcFlags
 
static uint8_t channel
 
static uint8_t muxChannel
 

Function Documentation

◆ InitADC()

void InitADC ( void  )

Initializes the ADC.

The ADC is set to free running mode at 115.2kHz clock. This gives one result every 113us or one complete set every 564us.

Referenced by CmdCalibrate(), and Init().

Here is the caller graph for this function:

◆ ISR()

ISR ( ADC_vect  )

ADC Conversion Complete Interrupt.

Calculates the Value of the current channel and switches MUX and REF to the next channel.
The flag ADCFLAG_NEWRESULTS (all channels have been updated) will be set every 564us, ADCFLAG_NEWAVERAGES will be available every 36.1ms.
Optimization for Size (-Os): This routine takes about 37us worst case.

References ADCData, ADCDataAvg, ADCDataMaxTmp, ADCDataMinTmp, ADCFLAG_NEWAVERAGES, ADCFLAG_NEWRESULTS, adcFlags, ADCData_t::array, channel, LEDRedOff(), LEDRedOn(), and muxChannel.

Here is the call graph for this function:

Variable Documentation

◆ ADCData

volatile ADCData_t ADCData

ADC-Values for the last measurement.

Referenced by CmdStat(), FTestSWUnreg(), ISR(), and TempFromADC().

◆ ADCDataAvg

volatile ADCData_t ADCDataAvg

◆ ADCDataMax

volatile ADCData_t ADCDataMax

Maximum ADC-Values during last average Period.

Referenced by CmdStat(), and main().

◆ ADCDataMaxTmp

volatile ADCData_t ADCDataMaxTmp

Maximum ADC-Values in the current Period.

Referenced by DoTflags(), and ISR().

◆ ADCDataMin

volatile ADCData_t ADCDataMin

Minimum ADC-Values during last average Period.

Referenced by CmdStat(), and main().

◆ ADCDataMinTmp

volatile ADCData_t ADCDataMinTmp

Minimum ADC-Values in the current Period.

Referenced by DoTflags(), and ISR().

◆ adcFlags

volatile uint8_t adcFlags

Referenced by EnterDouble(), FTestSWUnreg(), and ISR().

◆ channel

uint8_t channel
static

Referenced by InitADC(), and ISR().

◆ muxChannel

uint8_t muxChannel
static

Referenced by InitADC(), and ISR().