Electronic Load 1.0 Programmable Constant Current Sink

adc.h
Go to the documentation of this file.
1 /*
2 * adc.h
3 *
4 * Created: 13.11.2012 14:05:16
5 * Author: rolo
6 */
7
8
9 #ifndef ADC_H_
10 #define ADC_H_
11
12 extern volatile uint8_t adcFlags;
13 static const uint8_t ADCFLAG_NEWRESULTS=1;
14 static const uint8_t ADCFLAG_NEWAVERAGES=2;
15
18 typedef union
19 {
20 struct
21 {
22 uint16_t ADC_Chan0;
23 uint16_t ADC_Chan1;
24 uint16_t ADC_Chan2;
25 uint16_t ADC_Chan3;
26 uint16_t ADC_HSTemp;
27 uint16_t ADC_Temp;
28 uint16_t ADC_P5;
29 uint16_t ADC_P12;
30 } named;
31 uint16_t array[8];
32 } ADCData_t;
33
34
35 extern ADCData_t ADCData;
36 extern ADCData_t ADCDataAvg;
37 extern ADCData_t ADCDataMin;
38 extern ADCData_t ADCDataMax;
39 static ADCData_t ADCDataMinTmp;
40 static ADCData_t ADCDataMaxTmp;
41
42 void InitADC(void);
43 void ADCNextChannel(void);
44
47 static inline void ADCResetMinMax(void)
48 {
49 for (int i=4;i>=0;i--)
50 {
51 ADCDataMin.array[i]=ADCDataMinTmp.array[i];
52 ADCDataMax.array[i]=ADCDataMaxTmp.array[i];
53 ADCDataMinTmp.array[i]=0xffff;
54 ADCDataMaxTmp.array[i]=0;
55 }
56 }
57
58 #endif /* ADC_H_ */
ADCResetMinMax
static void ADCResetMinMax(void)
Resets the Min/Max values of the Analog Values.
Definition: adc.h:47
ADCDataMinTmp
static ADCData_t ADCDataMinTmp
Definition: adc.h:39
InitADC
void InitADC(void)
Initializes the On Chip ADC.
Definition: adc.c:49
ADCDataMin
ADCData_t ADCDataMin
Minimum ADC-Values during last average Period.
Definition: adc.c:37
ADCFLAG_NEWRESULTS
static const uint8_t ADCFLAG_NEWRESULTS
All Channels have been updated.
Definition: adc.h:13
ADCData_t::ADC_Chan0
uint16_t ADC_Chan0
Definition: adc.h:22
ADCData_t
Holds raw ADC Values for all Channels.
Definition: adc.h:18
ADCNextChannel
void ADCNextChannel(void)
ADCDataMax
ADCData_t ADCDataMax
Maximum ADC-Values during last average Period.
Definition: adc.c:39
ADCData_t::ADC_HSTemp
uint16_t ADC_HSTemp
Temperature of the Heatsink.
Definition: adc.h:26
ADCData_t::array
uint16_t array[8]
Array for access via Channel Number.
Definition: adc.h:31
adcFlags
volatile uint8_t adcFlags
Definition: adc.c:32
ADCData_t::ADC_P12
uint16_t ADC_P12
12V Supply
Definition: adc.h:29
ADCData_t::ADC_Temp
uint16_t ADC_Temp
Display Temperature.
Definition: adc.h:27
ADCData
ADCData_t ADCData
ADC-Values for the last measurement.
Definition: adc.c:35
ADCDataAvg
ADCData_t ADCDataAvg
Averaged ADC-Values.
Definition: adc.c:36
ADCData_t::ADC_Chan1
uint16_t ADC_Chan1
Definition: adc.h:23
ADCData_t::ADC_P5
uint16_t ADC_P5
5V Supply
Definition: adc.h:28
ADCDataMaxTmp
static ADCData_t ADCDataMaxTmp
Definition: adc.h:40
ADCData_t::ADC_Chan3
uint16_t ADC_Chan3
Definition: adc.h:25
ADCFLAG_NEWAVERAGES
static const uint8_t ADCFLAG_NEWAVERAGES
All Averages have been updated.
Definition: adc.h:14
ADCData_t::ADC_Chan2
uint16_t ADC_Chan2
Definition: adc.h:24