Electronic Load  1.0
Programmable Constant Current Sink
Functions | Variables
adc.c File Reference

Routines for handling the internal ADC (Supply and Temperature measurement) More...

Include dependency graph for adc.c:

Functions

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

Variables

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

Detailed Description

Routines for handling the internal ADC (Supply and Temperature measurement)

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

◆ InitADC()

void InitADC ( void  )

Initializes the On Chip 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.

◆ 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.

Variable Documentation

◆ channel

uint8_t channel
static

◆ muxChannel

uint8_t muxChannel
static

◆ adcFlags

volatile uint8_t adcFlags

◆ ADCData

ADCData_t ADCData

ADC-Values for the last measurement.

◆ ADCDataAvg

ADCData_t ADCDataAvg

Averaged ADC-Values.

◆ ADCDataMin

ADCData_t ADCDataMin

Minimum ADC-Values during last average Period.

◆ ADCDataMinTmp

ADCData_t ADCDataMinTmp
static

Minimum ADC-Values in the current Period.

◆ ADCDataMax

ADCData_t ADCDataMax

Maximum ADC-Values during last average Period.

◆ ADCDataMaxTmp

ADCData_t ADCDataMaxTmp
static

Maximum ADC-Values in the current Period.