Electronic Load 1.0 Programmable Constant Current Sink

Data Structures | Macros | Functions | Variables
config.h File Reference

Structures and Constants for Configuration Handling. More...

Include dependency graph for config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | confStruct_t
| Holds all Configuration Data stored in EEPROM. More...
struct | soa_t
struct | volatileConfStruct_t
| These values will be calculated by ReadConfig() and/or on-the-fly by measurement. More...

## Macros
#define | CONF_MAGIC 0x0151
| Increment this value if confStruct_t becomes incompatible to previous versions! More...
#define | PRESET0 0.0
#define | PRESET1 0.001
#define | PRESET2 0.0015
#define | PRESET3 0.005
#define | PRESET4 0.01
#define | PRESET5 0.05
#define | PRESET6 0.1
#define | PRESET7 0.5
#define | PRESET8 1.0
#define | PRESET9 4.0
#define | R12 8200.0
| High side Resistor to the 2.5V Reference Voltage. More...
#define | R13 2200.0
| Low side Resistor to the 2.5V Reference Voltage. More...
#define | R16 120000.0
| High Side Voltage Divider Resistor. More...
#define | R18 1000.0
| Low Side Voltage Divider Resistor. More...
#define | R23 0.1
| High Range Shunt Resistor. More...
#define | R25 3.3
| Low Range Shunt Resistor. More...
#define | SOA_I2 3.2
| The Current at the upper Margin of const Pv. More...
#define | SOA_I3 0.35
| The allowable Current at 60V. More...
#define | SOA_IMAX 4.0
| The absolute maximum Current. More...
#define | SOA_PMAX 80.0
| The maximum allowable Power Dissipation. More...
#define | SOA_V2 25.0
| The Voltage at the upper Margin of const Pv. More...
#define | SPIADCVOLTSPERLSB (SPIVREF/65536)
| Native ADC Voltage per LSB. More...
#define | SPIDIFFVOLTSPERLSB (SPIADCVOLTSPERLSB/R18*(R16+R18))
| Volts per LSB for the differential Voltage Sensor. More...
#define | SPIHIGHAMPSPERLSB (SPIADCVOLTSPERLSB/R23)
| Amperes per LSB in High Current Range. More...
#define | SPILOWAMPSPERLSB (SPIADCVOLTSPERLSB/R25)
| Amperes per LSB in Low Current Range. More...
#define | SPIVREF (2.5/(R12+R13)*R13)
| Reference voltage for the SPI ADC. More...
#define | TEMP_MAX 80
| Maximum sink temperature before Eload switches off. More...

## Functions
void | DumpConfig (void)
| Lists the current configuration values. More...
void | DumpConfigSignal (uint8_t number)
void | ReadConfig (void)
| Reads the Config-Struct from EEPROM into config. More...
double | SOAGetImax (double v)
| Calculate maximum allowable Current at a given Voltage. More...
void | WriteConfig (void)
| Writes the Config-Struct to EEPROM. More...

## Variables
confStruct_t | config
| The Configuration. It is read on startup from the EEPROM. More...
bool | configDirty
| Set to true by routines affecting configuration if config memory needs to be saved to the EEPROM. More...
volatileConfStruct_t | volatileConfig
| Configuration Values that can be calculated. More...

## Detailed Description

Structures and Constants for Configuration Handling.

Copyright
  Copyright (C) 2013 Robert Loos http://www.loosweb.de

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

## Macro Definition Documentation

## ◆ CONF_MAGIC

#define CONF_MAGIC 0x0151

Increment this value if confStruct_t becomes incompatible to previous versions!

## ◆ R12

#define R12 8200.0

High side Resistor to the 2.5V Reference Voltage.

## ◆ R13

#define R13 2200.0

Low side Resistor to the 2.5V Reference Voltage.

## ◆ R16

#define R16 120000.0

High Side Voltage Divider Resistor.

## ◆ R18

#define R18 1000.0

Low Side Voltage Divider Resistor.

## ◆ R23

#define R23 0.1

High Range Shunt Resistor.

## ◆ R25

#define R25 3.3

Low Range Shunt Resistor.

## ◆ SPIVREF

#define SPIVREF (2.5/(R12+R13)*R13)

Reference voltage for the SPI ADC.

## ◆ SPIADCVOLTSPERLSB

#define SPIADCVOLTSPERLSB (SPIVREF/65536)

Native ADC Voltage per LSB.

## ◆ SPIDIFFVOLTSPERLSB

#define SPIDIFFVOLTSPERLSB (SPIADCVOLTSPERLSB/R18*(R16+R18))

Volts per LSB for the differential Voltage Sensor.

## ◆ SPIHIGHAMPSPERLSB

#define SPIHIGHAMPSPERLSB (SPIADCVOLTSPERLSB/R23)

Amperes per LSB in High Current Range.

## ◆ SPILOWAMPSPERLSB

#define SPILOWAMPSPERLSB (SPIADCVOLTSPERLSB/R25)

Amperes per LSB in Low Current Range.

## ◆ PRESET0

#define PRESET0 0.0

## ◆ PRESET1

#define PRESET1 0.001

## ◆ PRESET2

#define PRESET2 0.0015

## ◆ PRESET3

#define PRESET3 0.005

## ◆ PRESET4

#define PRESET4 0.01

## ◆ PRESET5

#define PRESET5 0.05

## ◆ PRESET6

#define PRESET6 0.1

## ◆ PRESET7

#define PRESET7 0.5

## ◆ PRESET8

#define PRESET8 1.0

## ◆ PRESET9

#define PRESET9 4.0

## ◆ SOA_PMAX

#define SOA_PMAX 80.0

The maximum allowable Power Dissipation.

## ◆ SOA_V2

#define SOA_V2 25.0

The Voltage at the upper Margin of const Pv.

## ◆ SOA_IMAX

#define SOA_IMAX 4.0

The absolute maximum Current.

## ◆ SOA_I2

#define SOA_I2 3.2

The Current at the upper Margin of const Pv.

## ◆ SOA_I3

#define SOA_I3 0.35

The allowable Current at 60V.

## ◆ TEMP_MAX

#define TEMP_MAX 80

Maximum sink temperature before Eload switches off.

## Function Documentation

## ◆ ReadConfig()

void ReadConfig | ( | void |  | ) |

Reads the Config-Struct from EEPROM into config.

Only the config-struct in RAM will be used. Changes in config will only become permanent if you use a write-command. There is a configDirty-flag that is set by every routine that changes config and is used to remind the user to execute a write-command.

Here is the call graph for this function:

## ◆ WriteConfig()

void WriteConfig | ( | void |  | ) |

Writes the Config-Struct to EEPROM.

Here is the call graph for this function:

## ◆ DumpConfigSignal()

void DumpConfigSignal | ( | uint8_t | number | ) |

## ◆ DumpConfig()

void DumpConfig | ( | void |  | ) |

Lists the current configuration values.

Prints a verbose explanation of the configuration data to the host. This function relies on hprintf_P() which does the work and knows where the host is...

Note
  This function evaluates to nothing if SAVE_MEMORY is defined.

Here is the call graph for this function:

## ◆ SOAGetImax()

double SOAGetImax | ( | double | v | ) |

Calculate maximum allowable Current at a given Voltage.

Parameters

  v | The Voltage currently applied

Returns
  The maximum allowable Current to stay within the SOA

## Variable Documentation

## ◆ configDirty

bool configDirty

Set to true by routines affecting configuration if config memory needs to be saved to the EEPROM.

## ◆ config

confStruct_t config

The Configuration. It is read on startup from the EEPROM.

## ◆ volatileConfig

volatileConfStruct_t volatileConfig

Configuration Values that can be calculated.