MODEL_ADC/APP/main.c

29 lines
971 B
C

#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include "ADC_Temp_KST45-14-2.h"
#include "aterlux.h"
int main() {
init_fast_lookup_table(ALG_STEINHART);
uint16_t value = 4095 / 2; // Должно быть 25 градусов. Это середина диапазона АЦП
float T_ALG_LINEAR = get_temperature_from_adc_KST45(value, ALG_LINEAR);
float T_ALG_STEINHART = get_temperature_from_adc_KST45(value, ALG_STEINHART);
float T_ALG_STEINHART_FULL = get_temperature_from_adc_KST45(value, ALG_STEINHART_FULL);
float T_FAST = get_temperature_fast_KST45(value);
float T_ATERLUX = calc_temperature(value);
printf("T_ALG_LINEAR = %f \n", T_ALG_LINEAR);
printf("T_ALG_STEINHART = %f \n", T_ALG_STEINHART);
printf("T_ALG_STEINHART_FULL = %f \n", T_ALG_STEINHART_FULL);
printf("T_FAST = %f \n", T_FAST / 10);
printf("T_ATERLUX = %f \n", T_ATERLUX / 10);
return 0;
}