Electronic Load 1.0 Programmable Constant Current Sink

config.h
Go to the documentation of this file.
1
20 #ifndef CONFIG_H_
21 #define CONFIG_H_
22
23 #include <stdbool.h>
24 #include <stdio.h>
25 #include "eload.h"
26
27 #define CONF_MAGIC 0x0151
28
29 // Definition of the Resistors according to the Schematics
30 #define R12 8200.0
31 #define R13 2200.0
32 #define R16 120000.0
33 #define R18 1000.0
34 #define R23 0.1
35 #define R25 3.3
36
37 #define SPIVREF (2.5/(R12+R13)*R13)
38 #define SPIADCVOLTSPERLSB (SPIVREF/65536)
39 #define SPIDIFFVOLTSPERLSB (SPIADCVOLTSPERLSB/R18*(R16+R18))
40 #define SPIHIGHAMPSPERLSB (SPIADCVOLTSPERLSB/R23)
41 #define SPILOWAMPSPERLSB (SPIADCVOLTSPERLSB/R25)
42
43 // Presets in A
44 #define PRESET0 0.0
45 #define PRESET1 0.001
46 #define PRESET2 0.0015
47 #define PRESET3 0.005
48 #define PRESET4 0.01
49 #define PRESET5 0.05
50 #define PRESET6 0.1
51 #define PRESET7 0.5
52 #define PRESET8 1.0
53 #define PRESET9 4.0
54
55 /*#define SOA_PMAX 80.0 ///< The maximum allowable Power Dissipation
56 #define SOA_V2 25.0 ///< The Voltage at the upper Margin of const Pv
57 #define SOA_IMAX 4.0 ///< The absolute maximum Current
58 #define SOA_I2 3.2 ///< The Current at the upper Margin of const Pv
59 #define SOA_I3 0.35 ///< The allowable Current at 60V*/
60 #define SOA_PMAX 80.0
61 #define SOA_V2 25.0
62 #define SOA_IMAX 4.0
63 #define SOA_I2 3.2
64 #define SOA_I3 0.35
65 #define TEMP_MAX 80
66
67 typedef struct
68 {
69 uint8_t tempMax;
70 double pMax;
71 double v2;
72 double iMax;
73 double i2;
74 double i3;
75 } soa_t;
76
82 typedef struct
83 { uint16_t magic;
84 uint8_t LCDV0;
85 uint8_t LCDBright;
86 double P5VoltsPerLSB;
87 double P12VoltsPerLSB;
88 bool backlightAlwaysOn;
89 uint8_t backlightOnTime;
90 double preset[10];
91 double ADCLowAmpsPerLSB;
92 double ADCHighAmpsPerLSB;
93 double ADCDiffVoltsPerLSB;
94 double DACLowAmpsPerLSB;
95 double DACHighAmpsPerLSB;
96 soa_t soa;
97 #ifdef USE_RTS
98 uint8_t useRts;
99 #endif
100 } confStruct_t;
101 extern bool configDirty;
102
109 typedef struct
110 { double Rlow;
111 double Rhigh;
112 double RchanP;
113 double dacHighAdj;
114 double rangeHighLimit;
115 double rangeLowLimit;
116 double VImax;
117 double SBa;
118 double SBb;
119 } volatileConfStruct_t;
120
121 extern confStruct_t config;
122 extern volatileConfStruct_t volatileConfig;
123 extern void ReadConfig(void);
124 extern void WriteConfig(void);
125 extern void DumpConfigSignal(uint8_t number);
126 extern void DumpConfig(void);
127 extern double SOAGetImax(double v);
128
129 #endif /* CONFIG_H_ */
Eload.h
soa_t::i2
double i2
Current Limit for Pv-Area (3.5A for TIP102)
Definition: config.h:73
confStruct_t::DACHighAmpsPerLSB
double DACHighAmpsPerLSB
Amperes per LSB in High Current Range.
Definition: config.h:95
volatileConfStruct_t::dacHighAdj
double dacHighAdj
A factor considering RchanP.
Definition: config.h:113
soa_t::tempMax
uint8_t tempMax
Definition: config.h:69
WriteConfig
void WriteConfig(void)
Writes the Config-Struct to EEPROM.
Definition: config.c:148
soa_t::i3
double i3
Current Limit for 60V (350mA for TIP102)
Definition: config.h:74
confStruct_t
Holds all Configuration Data stored in EEPROM.
Definition: config.h:82
DumpConfigSignal
void DumpConfigSignal(uint8_t number)
volatileConfStruct_t::rangeLowLimit
double rangeLowLimit
Below this Current, Eload switches to low current Range.
Definition: config.h:115
volatileConfig
volatileConfStruct_t volatileConfig
Configuration Values that can be calculated.
Definition: config.c:38
soa_t
Definition: config.h:67
soa_t::iMax
double iMax
The absolute maximum Current. Eload will not allow currents more than this.
Definition: config.h:72
confStruct_t::LCDV0
uint8_t LCDV0
Control Voltage for LCD Contrast.
Definition: config.h:84
volatileConfStruct_t::Rhigh
double Rhigh
Value of the Sense Resistor for High Current Range.
Definition: config.h:111
confStruct_t::ADCHighAmpsPerLSB
double ADCHighAmpsPerLSB
Amperes per LSB in High Current Range.
Definition: config.h:92
soa_t::pMax
double pMax
Up to this Voltage, 4A are allowable (20V for TIP102)
Definition: config.h:70
volatileConfStruct_t::SBa
double SBa
Definition: config.h:117
volatileConfStruct_t::Rlow
double Rlow
Value of the Sense Resistor for Low Current Range.
Definition: config.h:110
DumpConfig
void DumpConfig(void)
Lists the current configuration values.
Definition: config.c:186
volatileConfStruct_t::VImax
double VImax
Maximum Voltage at IMax.
Definition: config.h:116
confStruct_t::magic
uint16_t magic
Used to discover unprogrammed Devices.
Definition: config.h:83
confStruct_t::DACLowAmpsPerLSB
double DACLowAmpsPerLSB
Amperes per LSB in Low Current Range.
Definition: config.h:94
volatileConfStruct_t
These values will be calculated by ReadConfig() and/or on-the-fly by measurement.
Definition: config.h:109
configDirty
bool configDirty
Set to true by routines affecting configuration if config memory needs to be saved to the EEPROM.
Definition: config.c:116
volatileConfStruct_t::SBb
double SBb
Definition: config.h:118
config
confStruct_t config
The Configuration. It is read on startup from the EEPROM.
Definition: config.c:37
volatileConfStruct_t::rangeHighLimit
double rangeHighLimit
Above this Current, Eload switches to high current Range.
Definition: config.h:114
confStruct_t::backlightAlwaysOn
bool backlightAlwaysOn
True if the Backlight should stay on forever.
Definition: config.h:88
confStruct_t::P5VoltsPerLSB
double P5VoltsPerLSB
Calibration Value for 5V.
Definition: config.h:86
ReadConfig
void ReadConfig(void)
Reads the Config-Struct from EEPROM into config.
Definition: config.c:125
confStruct_t::ADCDiffVoltsPerLSB
double ADCDiffVoltsPerLSB
Volts per LSB for differential Voltage measurement.
Definition: config.h:93
confStruct_t::ADCLowAmpsPerLSB
double ADCLowAmpsPerLSB
Amperes per LSB in Low Current Range.
Definition: config.h:91
volatileConfStruct_t::RchanP
double RchanP
Calculated Channel Resistance of the FET shorting Rhigh || Rhigh.
Definition: config.h:112
confStruct_t::backlightOnTime
uint8_t backlightOnTime
Time the Backlight will stay on after Key Press in Seconds.
Definition: config.h:89
confStruct_t::LCDBright
uint8_t LCDBright
LCD Brightness.
Definition: config.h:85
confStruct_t::soa
soa_t soa
The Safe Operating Area.
Definition: config.h:96
confStruct_t::P12VoltsPerLSB
double P12VoltsPerLSB
Calibration Value for Unreg.
Definition: config.h:87
soa_t::v2
double v2
Voltage Limit for Pv-Area (25V for TIP102)
Definition: config.h:71
SOAGetImax
double SOAGetImax(double v)
Calculate maximum allowable Current at a given Voltage.
Definition: config.c:165