source: trunk/fw_g473rct/SES/src/shunt_temperature.c@ 20

Last change on this file since 20 was 20, checked in by f.jahn, 4 months ago

adc dma funktioniert und modbus funktioniert

File size: 2.0 KB
Line 
1/******************************************************************************
2*
3* @file chipTemperature.c
4* @author ECS, Joseph Zimmer
5* @version V1.0.0
6* @date 24-04-2019
7* @brief
8*
9******************************************************************************/
10
11// --- INCLUDES -----------------------------------------------------------------
12#include <stdio.h>
13#include "sysdata.h"
14#include "shunt_temperature.h"
15#include "adc.h"
16// --- EXTERNE VARIABLEN --------------------------------------------------------
17
18// --- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
19
20// --- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
21
22// --- DEFINITIONEN GLOBALER VARIABLEN - Bitte in Header dokumentieren ----------
23
24// --- LOKALE VARIABLEN - bitte hier dokumentieren ------------------------------
25
26// --- LOKALE FUNKTIONS PROTOTYPEN ----------------------------------------------
27
28// --- LOKALE FUNKTIONEN - bitte hier dokumentieren -----------------------------
29
30/*
31* @brief
32* @param kein
33* @retval kein
34*/
35
36// --- GLOBALE FUNKTIONEN - bitte in Header dokumentieren------------------------
37
38void SHUNT_TEMPERATURE_Exec(int32_t adcval)
39{
40 int32_t temp;
41
42
43 //Umrechnung Spannung in mV
44 temp = (adcval * 3300 ) / 65536;
45
46 //Umrechnung in °C mit PT 1000 Sensor
47// temp = temp - 747;
48// temp = temp * 70.406;
49
50 //Umrechnung in °C mit LM61 Sensor
51 temp = temp - 600;
52 temp = temp * 100;
53
54 //2Nackommastellen
55 //milli grad in grad * 100 /festkomma
56 sys_data.s.values.shuntTemperature = temp / 10;
57
58
59 if(sys_data.s.values.shuntTemperature > sys_data.s.values.shuntTemperatureMax)
60 {
61 sys_data.s.values.shuntTemperatureMax = sys_data.s.values.shuntTemperature;
62 }
63 else if (sys_data.s.values.shuntTemperature < sys_data.s.values.shuntTemperatureMin)
64 {
65 sys_data.s.values.shuntTemperatureMin = sys_data.s.values.shuntTemperature;
66 }
67
68}
69
70/*************************** End of file ****************************/
Note: See TracBrowser for help on using the repository browser.