Electronic Load 1.0 Programmable Constant Current Sink

Eload.h
Go to the documentation of this file.
1 /*
2 * Eload.h
3 *
4 * Created: 08.11.2013 11:59:33
5 * Author: rolo
6 */
7
8
9 #ifndef ELOAD_H_
10 #define ELOAD_H_
11
12 #include <stdint.h>
13 #include <stddef.h>
14 #include <avr/pgmspace.h>
15
16 typedef uint8_t delay_t;
17
18 #define ADC_MIN_CHANNEL 4
19 #define ADC_MAX_CHANNEL 7
20 #define ADCVoltsPerLSB (2.56/1024)
21 #define dividerP5 (4.7/(4.7+22))
22 #define dividerP12 (4.7/(4.7+68))
23
24 extern uint8_t mcusrMirror;
25 extern volatile uint8_t tickCnt,secCnt,minCnt,hrCnt;
26
32 extern volatile uint8_t tFlags;
33 static const uint8_t TFLAG_SEC=1;
34 static const uint8_t TFLAG_MIN=2;
35 static const uint8_t TFLAG_HOUR=4;
36 static const uint8_t TFLAG_DAY=8;
37
39 extern volatile uint8_t sFlags;
40 static const uint8_t SFLAG_REFRESH=1;
41
42 extern volatile uint8_t dFlags;
43 static const uint8_t DFLAG_ADC=1;
44 static const uint8_t DFLAG_SENSOR=2;
45 static const uint8_t DFLAG_AH=4;
46 static const uint8_t DFLAG_RCHAN=8;
47
54 extern volatile uint8_t eflags;
55 static const uint8_t EFLAG_NTC1=1;
56 static const uint8_t EFLAG_NTC2=2;
57 static const uint8_t EFLAG_P5=4;
58 static const uint8_t EFLAG_P12=8;
59 static const uint8_t EFLAG_SOA=16;
60 static const uint8_t EFLAG_TEMP=32;
61 static const uint8_t EFLAG_AVG_LOST=64;
62
63 extern PGM_P const eflag_descr[];
64
65 void DoFlags();
66
67 extern void Ticks2HMS(uint32_t ticks, char *str, size_t n);
68
69 #endif /* ELOAD_H_ */
EFLAG_NTC1
static const uint8_t EFLAG_NTC1
NTC1 (the onboard one) seems non-functional.
Definition: Eload.h:55
TFLAG_SEC
static const uint8_t TFLAG_SEC
Is set once per Second.
Definition: Eload.h:33
eflags
volatile uint8_t eflags
Error Flags.
Definition: Eload.c:64
DFLAG_ADC
static const uint8_t DFLAG_ADC
Gives information about voltage and current measurements.
Definition: Eload.h:43
mcusrMirror
uint8_t mcusrMirror
Copy of the MCUSR taken shortly after reset.
Definition: Eload.c:293
EFLAG_TEMP
static const uint8_t EFLAG_TEMP
Heat Sink Overtemp.
Definition: Eload.h:60
TFLAG_MIN
static const uint8_t TFLAG_MIN
Is set once per Minute at Second 0.
Definition: Eload.h:34
secCnt
volatile uint8_t secCnt
Seconds of the RTC.
Definition: Eload.c:66
dFlags
volatile uint8_t dFlags
Flags Controlling Debug Output.
Definition: Eload.c:63
EFLAG_SOA
static const uint8_t EFLAG_SOA
Indicates Limits caused by the SOA of the Transistor. Should be somehow displayed!
Definition: Eload.h:59
EFLAG_NTC2
static const uint8_t EFLAG_NTC2
NTC2 (the NTC on the Heat Sink) seems non-functional.
Definition: Eload.h:56
tickCnt
volatile uint8_t tickCnt
Counter for timer0 interrupts.
Definition: Eload.c:65
TFLAG_HOUR
static const uint8_t TFLAG_HOUR
Is set once per Hour at Minute 0.
Definition: Eload.h:35
EFLAG_P5
static const uint8_t EFLAG_P5
+5V Supply out of tolerance
Definition: Eload.h:57
sFlags
volatile uint8_t sFlags
Flags used for Screen Control.
Definition: screen.c:45
DFLAG_SENSOR
static const uint8_t DFLAG_SENSOR
Gives information about sensors and on chip ADC.
Definition: Eload.h:44
SFLAG_REFRESH
static const uint8_t SFLAG_REFRESH
Is set three times per Second when Refresh-Items should be handled.
Definition: Eload.h:40
hrCnt
volatile uint8_t hrCnt
Hours of the RTC.
Definition: Eload.c:68
DFLAG_RCHAN
static const uint8_t DFLAG_RCHAN
Gives information about channel resistance computation.
Definition: Eload.h:46
delay_t
uint8_t delay_t
Definition: Eload.h:16
tFlags
volatile uint8_t tFlags
Flags set by Timer Interrupt to signal Main Loop.
Definition: Eload.c:62
TFLAG_DAY
static const uint8_t TFLAG_DAY
Is set every Day at Midnight.
Definition: Eload.h:36
DoFlags
void DoFlags()
Process Communication-, Time- and Key-Flags.
Definition: Eload.c:275
EFLAG_P12
static const uint8_t EFLAG_P12
+12V Supply out of tolerance
Definition: Eload.h:58
EFLAG_AVG_LOST
static const uint8_t EFLAG_AVG_LOST
New Averages were ready but the New Averages Flag was still set.
Definition: Eload.h:61
eflag_descr
PGM_P const eflag_descr[]
Array of strings containing a description for each flag.
Definition: Eload.c:83
minCnt
volatile uint8_t minCnt
Minutes of the RTC.
Definition: Eload.c:67
Ticks2HMS
void Ticks2HMS(uint32_t ticks, char *str, size_t n)
Definition: Eload.c:89
DFLAG_AH
static const uint8_t DFLAG_AH
Gives information about Ah and Wh calculations.
Definition: Eload.h:45