source: trunk/fw_g473rct/SES/src/ltc_current.c@ 71

Last change on this file since 71 was 71, checked in by f.jahn, 5 days ago

vor cube code generierung

File size: 2.2 KB
Line 
1/******************************************************************************
2*
3* @file ltc_current.c
4* @author ECS, Falko Jahn
5* @version V1.0.0
6* @date 2026-03-21
7* @brief
8*
9******************************************************************************/
10
11// --- INCLUDES -----------------------------------------------------------------
12#include "sysdata.h"
13#include "ltc_current.h"
14
15// --- EXTERNE VARIABLEN --------------------------------------------------------
16
17// --- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
18
19// --- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
20
21// --- DEFINITIONEN GLOBALER VARIABLEN - Bitte in Header dokumentieren ----------
22
23// --- LOKALE VARIABLEN - bitte hier dokumentieren ------------------------------
24
25// --- LOKALE FUNKTIONS PROTOTYPEN ----------------------------------------------
26
27// --- LOKALE FUNKTIONEN - bitte hier dokumentieren -----------------------------
28
29/*
30* @brief
31* @param kein
32* @retval kein
33*/
34
35// --- GLOBALE FUNKTIONEN - bitte in Header dokumentieren------------------------
36
37void LTC_CURRENT_Exec(int32_t adcval, int32_t adcval2)
38{
39 double temp1, temp2;
40
41
42 //Umrechnung Spannung in mV
43 temp1 = (adcval * VREF ) / 65536.0;
44 temp2 = (adcval2 * VREF ) / 65536.0;
45
46
47 #if DEVICETYPE == 125
48 temp1 = temp1 * 600; //6 / 20 / 0.0005;
49 temp2 = temp2 * 600; //6 / 20 / 0.0005;
50 #elif DEVICETYPE == 250
51 temp1 = temp1 / 20;
52 temp1 = temp1 * 6;
53 temp1 = temp1 / 0.000250;
54 temp2 = temp2 / 20;
55 temp2 = temp2 * 6;
56 temp2 = temp2 / 0.000250;
57 #endif
58
59
60 //Nur Amperere
61 //
62 sys_data.s.values.ltc_discharge_current = temp1/1000;
63 sys_data.s.values.ltc_charge_current = temp2/1000;
64
65
66 if(sys_data.s.values.ltc_discharge_current > sys_data.s.values.ltc_discharge_current_max)
67 {
68 sys_data.s.values.ltc_discharge_current_max = sys_data.s.values.ltc_discharge_current;
69 }
70
71 if(sys_data.s.values.ltc_charge_current > sys_data.s.values.ltc_charge_current_max)
72 {
73 sys_data.s.values.ltc_charge_current_max = sys_data.s.values.ltc_charge_current;
74 }
75
76
77
78}
79/*************************** End of file ****************************/
Note: See TracBrowser for help on using the repository browser.