diff --git a/prosjekt.X/nbproject/configurations.xml b/prosjekt.X/nbproject/configurations.xml index 047a263..3cb0be9 100644 --- a/prosjekt.X/nbproject/configurations.xml +++ b/prosjekt.X/nbproject/configurations.xml @@ -1,180 +1,180 @@ - - - - - eeprom.h - themistor-temp.h - - - - - main.c - eeprom.c - thermistor-temp.c - - - Makefile - - - Makefile - - - - localhost - AVR128DB48 - - - nEdbgTool - XC8 - 2.45 - 2 - - - - - - - - - - - - - - - false - false - - - - - - - false - false - - false - - false - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + eeprom.h + themistor-temp.h + + + Makefile + + + + + main.c + eeprom.c + thermistor-temp.c + + + Makefile + + + + localhost + AVR128DB48 + + + nEdbgTool + XC8 + 2.46 + 2 + + + + + + + + + + + + + + + false + false + + + + + + + false + false + + false + + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prosjekt.X/themistor-temp.h b/prosjekt.X/themistor-temp.h index 2b715d1..65c622c 100644 --- a/prosjekt.X/themistor-temp.h +++ b/prosjekt.X/themistor-temp.h @@ -1,38 +1,40 @@ -/* - * File: themistor-temp.h - * Author: athamantis - * - * Created on 08 March 2024, 11:46 - */ - -#ifndef THEMISTOR_TEMP_H -#define THEMISTOR_TEMP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#define R_t0 10000 -#define T_0 298.15 -#define B 3950 -#define R_1 1000 - -// Takes inn messured value -// Calculates the temperature in celcius -// Returns the thermistor themperature -float calculate_thermistor_temp(float readValue); - - - - - -#ifdef __cplusplus -} -#endif - -#endif /* THEMISTOR_TEMP_H */ - +/* + * File: themistor-temp.h + * Author: athamantis + * + * Created on 08 March 2024, 11:46 + */ + +#ifndef THEMISTOR_TEMP_H +#define THEMISTOR_TEMP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#define R_t0 10000 +#define T_0 298.15 +#define B 3950 +#define R_1 1000 + +// Takes inn messured value +// Calculates the temperature in celcius +// Returns the thermistor themperature +float calculate_thermistor_temp(float readValue); + +bool error_message(float thermistor_temp); + + + +#ifdef __cplusplus +} +#endif + +#endif /* THEMISTOR_TEMP_H */ + diff --git a/prosjekt.X/thermistor-temp.c b/prosjekt.X/thermistor-temp.c index 7d6af52..47442f5 100644 --- a/prosjekt.X/thermistor-temp.c +++ b/prosjekt.X/thermistor-temp.c @@ -1,28 +1,37 @@ -#include "themistor-temp.h" - - -float calculate_thermistor_temp(float readValue){ - float R_therm; - float V_1; - float ln; - float T_therm; - float V_therm; - uint8_t V_tot = 5; - // Calculate Voltage over thermistor - V_therm = (V_tot/1024)*readValue; - - // Voltage accross R_1 - V_1 = V_tot - V_therm; - - // Calculate Thermistor resistanse - R_therm = (V_therm)/ (V_1 / R_1); - - // Steinhart-Harts formula - ln = log(R_therm/R_t0); - T_therm = (1/ ((ln/B) + (1/T_0))); - - // Temperatur in celcius - T_therm -= 273.15; - - return T_therm; -} +#include "themistor-temp.h" + +float calculate_thermistor_temp(float readValue){ + float R_therm; + float V_1; + float ln; + float T_therm; + float V_therm; + uint8_t V_tot = 5; + // Calculate Voltage over thermistor + V_therm = (V_tot/1024)*readValue; + + // Voltage accross R_1 + V_1 = V_tot - V_therm; + + // Calculate Thermistor resistanse + R_therm = (V_therm)/ (V_1 / R_1); + + // Steinhart-Harts formula + ln = log(R_therm/R_t0); + T_therm = (1/ ((ln/B) + (1/T_0))); + + // Temperatur in celcius + T_therm -= 273.15; + + return T_therm; +} + +bool error_message(float thermistor_temp){ + int high_temp = 0; + if (thermistor_temp > high_temp){ + return true; + } + else { + return false; + } +} \ No newline at end of file