|
@@ -44,8 +44,8 @@ extern volatile uint32_t DET_DL_Normal_Shutdown_On_AlarmTimerCnt[DET_Alarm_UL_In
|
44
|
44
|
extern volatile uint32_t DET_UL_Normal_Shutdown_On_AlarmTimerCnt[DET_Alarm_UL_Index_MAX] ;
|
45
|
45
|
|
46
|
46
|
extern ALL_PE43711_st ALL_ATT;
|
47
|
|
-extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
|
48
|
|
-extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
|
|
47
|
+//extern volatile uint16_t ADC1valuearray[4][ADC_AVERAGECNT];
|
|
48
|
+//extern volatile uint16_t ADC3valuearray[5][ADC_AVERAGECNT];
|
49
|
49
|
|
50
|
50
|
extern volatile uint32_t LedTimerCnt;
|
51
|
51
|
extern volatile uint32_t AdcTimerCnt;
|
|
@@ -78,6 +78,9 @@ extern volatile uint32_t Alarm_UL_Level_TimerOnCnt ;
|
78
|
78
|
extern volatile uint32_t SelfTestLifeCnt[4];
|
79
|
79
|
extern volatile uint32_t ADC_100ms_Cnt;
|
80
|
80
|
|
|
81
|
+extern volatile uint32_t HFR_ADC1value[ADC1_CNT];
|
|
82
|
+extern volatile uint32_t HFR_ADC3value[ADC3_CNT];
|
|
83
|
+
|
81
|
84
|
uint8_t Selftest_DL_PrevAttenSave[8] = {0,};
|
82
|
85
|
uint8_t Selftest_UL_PrevAttenSave[8] = {0,};
|
83
|
86
|
uint8_t TempShutdown_DL_SaveData[4] = {false,};
|
|
@@ -1954,11 +1957,11 @@ bool Bluecell_Operate(uint8_t* data){
|
1954
|
1957
|
if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true){
|
1955
|
1958
|
Tmpdata = bluecell_Currdatastatus.MBIC_ULO_ALC_Atten1_H << 8 | bluecell_Currdatastatus.MBIC_ULO_ALC_Atten1_L;
|
1956
|
1959
|
Tmpdata2 = bluecell_Currdatastatus.ATT_UL1_H << 8 | bluecell_Currdatastatus.ATT_UL1_L;
|
1957
|
|
-// if(Tmpdata + Tmpdata2 <= -200){
|
1958
|
|
-// Tmpdata2 = -200 + (Tmpdata * -1);
|
1959
|
|
-// bluecell_Currdatastatus.ATT_UL1_H = ((Tmpdata2 & 0xFF00) >> 8);
|
1960
|
|
-// bluecell_Currdatastatus.ATT_UL1_L = Tmpdata2 & 0x00FF;
|
1961
|
|
-// }
|
|
1960
|
+ if(Tmpdata + Tmpdata2 <= -200){
|
|
1961
|
+ Tmpdata2 = -200 + (Tmpdata * -1);
|
|
1962
|
+ bluecell_Currdatastatus.ATT_UL1_H = ((Tmpdata2 & 0xFF00) >> 8);
|
|
1963
|
+ bluecell_Currdatastatus.ATT_UL1_L = Tmpdata2 & 0x00FF;
|
|
1964
|
+ }
|
1962
|
1965
|
UL_ALC_GainAttenSet[ALC_Alarm_UL1_Index] = true;
|
1963
|
1966
|
ALC_Level_Save[ALC_Alarm_UL1_Index] = bluecell_Currdatastatus.ULO_Level1_H << 8 | bluecell_Currdatastatus.ULO_Level1_L;
|
1964
|
1967
|
}
|
|
@@ -1980,15 +1983,15 @@ bool Bluecell_Operate(uint8_t* data){
|
1980
|
1983
|
if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true){
|
1981
|
1984
|
Tmpdata = bluecell_Currdatastatus.MBIC_ULO_ALC_Atten2_H << 8 | bluecell_Currdatastatus.MBIC_ULO_ALC_Atten2_L;
|
1982
|
1985
|
Tmpdata2 = bluecell_Currdatastatus.ATT_UL2_H << 8 | bluecell_Currdatastatus.ATT_UL2_L;
|
1983
|
|
-// if(Tmpdata + Tmpdata2 <= -200){
|
1984
|
|
-// Tmpdata2 = -200 + (Tmpdata * -1);
|
1985
|
|
-// bluecell_Currdatastatus.ATT_UL2_H = ((Tmpdata2 & 0xFF00) >> 8);
|
1986
|
|
-// bluecell_Currdatastatus.ATT_UL2_L = Tmpdata2 & 0x00FF;
|
1987
|
|
-// }
|
|
1986
|
+ if(Tmpdata + Tmpdata2 <= -200){
|
|
1987
|
+ Tmpdata2 = -200 + (Tmpdata * -1);
|
|
1988
|
+ bluecell_Currdatastatus.ATT_UL2_H = ((Tmpdata2 & 0xFF00) >> 8);
|
|
1989
|
+ bluecell_Currdatastatus.ATT_UL2_L = Tmpdata2 & 0x00FF;
|
|
1990
|
+ }
|
1988
|
1991
|
UL_ALC_GainAttenSet[ALC_Alarm_UL2_Index] = true;
|
1989
|
1992
|
ALC_Level_Save[ALC_Alarm_UL2_Index] = bluecell_Currdatastatus.ULO_Level2_H << 8 | bluecell_Currdatastatus.ULO_Level2_L;
|
1990
|
1993
|
}
|
1991
|
|
-// CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
1994
|
+ CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
1992
|
1995
|
|
1993
|
1996
|
|
1994
|
1997
|
/*
|
|
@@ -2003,15 +2006,15 @@ bool Bluecell_Operate(uint8_t* data){
|
2003
|
2006
|
if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true){
|
2004
|
2007
|
Tmpdata = bluecell_Currdatastatus.MBIC_ULO_ALC_Atten3_H << 8 | bluecell_Currdatastatus.MBIC_ULO_ALC_Atten3_L;
|
2005
|
2008
|
Tmpdata2 = bluecell_Currdatastatus.ATT_UL3_H << 8 | bluecell_Currdatastatus.ATT_UL3_L;
|
2006
|
|
-// if(Tmpdata + Tmpdata2 <= -200){
|
2007
|
|
-// Tmpdata2 = -200 + (Tmpdata * -2);
|
2008
|
|
-// bluecell_Currdatastatus.ATT_UL3_H = ((Tmpdata2 & 0xFF00) >> 8);
|
2009
|
|
-// bluecell_Currdatastatus.ATT_UL3_L = Tmpdata2 & 0x00FF;
|
2010
|
|
-// }
|
|
2009
|
+ if(Tmpdata + Tmpdata2 <= -200){
|
|
2010
|
+ Tmpdata2 = -200 + (Tmpdata * -2);
|
|
2011
|
+ bluecell_Currdatastatus.ATT_UL3_H = ((Tmpdata2 & 0xFF00) >> 8);
|
|
2012
|
+ bluecell_Currdatastatus.ATT_UL3_L = Tmpdata2 & 0x00FF;
|
|
2013
|
+ }
|
2011
|
2014
|
UL_ALC_GainAttenSet[ALC_Alarm_UL3_Index] = true;
|
2012
|
2015
|
ALC_Level_Save[ALC_Alarm_UL3_Index] = bluecell_Currdatastatus.ULO_Level3_H << 8 | bluecell_Currdatastatus.ULO_Level3_L;
|
2013
|
2016
|
}
|
2014
|
|
-// CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
2017
|
+ CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
2015
|
2018
|
|
2016
|
2019
|
/*
|
2017
|
2020
|
Atten Ctrl Function
|
|
@@ -2025,15 +2028,15 @@ bool Bluecell_Operate(uint8_t* data){
|
2025
|
2028
|
if(bluecell_Currdatastatus.ULO_ALC_ON_OFF == true){
|
2026
|
2029
|
Tmpdata = bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_H << 8 | bluecell_Currdatastatus.MBIC_ULO_ALC_Atten4_L;
|
2027
|
2030
|
Tmpdata2 = bluecell_Currdatastatus.ATT_UL4_H << 8 | bluecell_Currdatastatus.ATT_UL4_L;
|
2028
|
|
-// if(Tmpdata + Tmpdata2 <= -200){
|
2029
|
|
-// Tmpdata2 = -200 + (Tmpdata * -2);
|
2030
|
|
-// bluecell_Currdatastatus.ATT_UL4_H = ((Tmpdata2 & 0xFF00) >> 8);
|
2031
|
|
-// bluecell_Currdatastatus.ATT_UL4_L = Tmpdata2 & 0x00FF;
|
2032
|
|
-// }
|
|
2031
|
+ if(Tmpdata + Tmpdata2 <= -200){
|
|
2032
|
+ Tmpdata2 = -200 + (Tmpdata * -2);
|
|
2033
|
+ bluecell_Currdatastatus.ATT_UL4_H = ((Tmpdata2 & 0xFF00) >> 8);
|
|
2034
|
+ bluecell_Currdatastatus.ATT_UL4_L = Tmpdata2 & 0x00FF;
|
|
2035
|
+ }
|
2033
|
2036
|
UL_ALC_GainAttenSet[ALC_Alarm_UL4_Index] = true;
|
2034
|
2037
|
ALC_Level_Save[ALC_Alarm_UL4_Index] = bluecell_Currdatastatus.ULO_Level4_H << 8 | bluecell_Currdatastatus.ULO_Level4_L;
|
2035
|
2038
|
}
|
2036
|
|
-// CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
|
2039
|
+ CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
|
2037
|
2040
|
|
2038
|
2041
|
ALCTimerCnt = 0;
|
2039
|
2042
|
|
|
@@ -3027,6 +3030,10 @@ bool Bluecell_Operate(uint8_t* data){
|
3027
|
3030
|
bluecell_Currdatastatus.UL_Det_Path_Offset[3] = data[BLUECELL_DATA];
|
3028
|
3031
|
// printf("Bluecell_UL_Det_Path4_Offset : %d \r\n",bluecell_Currdatastatus.UL_Det_Path_Offset[3]);
|
3029
|
3032
|
break;
|
|
3033
|
+ case Bluecell_Temp_Shutdown_Path_ON_OFF:
|
|
3034
|
+ bluecell_Prevdatastatus.Path_TempShutdown_Set = data[MBIC_PAYLOADSTART + 3];
|
|
3035
|
+ Temp_Shutdown_ONOFF(bluecell_Prevdatastatus.Path_TempShutdown_Set);
|
|
3036
|
+ break;
|
3030
|
3037
|
}
|
3031
|
3038
|
|
3032
|
3039
|
if(datatype != Bluecell_StatusReq
|
|
@@ -4532,7 +4539,7 @@ void Carrier_ONOFF(uint8_t val){
|
4532
|
4539
|
}
|
4533
|
4540
|
}
|
4534
|
4541
|
void Temp_Shutdown_ONOFF(uint8_t val){
|
4535
|
|
- if(val == 0){// ON
|
|
4542
|
+ if(val == 0){// ON //Path ON
|
4536
|
4543
|
bluecell_Currdatastatus.ATT_DL1_PATH= TempShutdown_DL_SaveData[0];
|
4537
|
4544
|
bluecell_Currdatastatus.ATT_DL2_PATH= TempShutdown_DL_SaveData[1];
|
4538
|
4545
|
bluecell_Currdatastatus.ATT_DL3_PATH= TempShutdown_DL_SaveData[2];
|
|
@@ -4553,6 +4560,8 @@ void Temp_Shutdown_ONOFF(uint8_t val){
|
4553
|
4560
|
TempShutdown_UL_SaveData[1] = bluecell_Currdatastatus.ATT_UL2_PATH;
|
4554
|
4561
|
TempShutdown_UL_SaveData[2] = bluecell_Currdatastatus.ATT_UL3_PATH;
|
4555
|
4562
|
TempShutdown_UL_SaveData[3] = bluecell_Currdatastatus.ATT_UL4_PATH;
|
|
4563
|
+
|
|
4564
|
+
|
4556
|
4565
|
bluecell_Currdatastatus.ATT_DL1_PATH = false;
|
4557
|
4566
|
bluecell_Currdatastatus.ATT_DL2_PATH = false;
|
4558
|
4567
|
bluecell_Currdatastatus.ATT_DL3_PATH = false;
|
|
@@ -4813,8 +4822,8 @@ bool MBIC_Operate(uint8_t* data){
|
4813
|
4822
|
bluecell_Currdatastatus.Manufacture_Date[i] = data[MBIC_PAYLOADSTART + 3 + i];
|
4814
|
4823
|
break;
|
4815
|
4824
|
case Temp_Shutdown_Path_ON_OFF:
|
4816
|
|
- bluecell_Prevdatastatus.MBIC_Download_Auto_Restart_Set = data[MBIC_PAYLOADSTART + 3];
|
4817
|
|
- Temp_Shutdown_ONOFF(bluecell_Prevdatastatus.MBIC_Download_Auto_Restart_Set);
|
|
4825
|
+ bluecell_Prevdatastatus.Path_TempShutdown_Set = data[MBIC_PAYLOADSTART + 3];
|
|
4826
|
+ Temp_Shutdown_ONOFF(bluecell_Prevdatastatus.Path_TempShutdown_Set);
|
4818
|
4827
|
break;
|
4819
|
4828
|
case Carrier_ON_OFF :
|
4820
|
4829
|
bluecell_Currdatastatus.Carrier_ON_OFF = data[MBIC_PAYLOADSTART + 3];
|
|
@@ -5284,7 +5293,6 @@ bool MBIC_Operate(uint8_t* data){
|
5284
|
5293
|
}
|
5285
|
5294
|
data[MBIC_CMD_0] = 0x81;//MBIC_ERRRESPONSE;
|
5286
|
5295
|
Length = MBIC_DataSend(data);
|
5287
|
|
-// if(Temp_Shutdown_Path_ON_OFF)
|
5288
|
5296
|
Bluecell_StructCpy(&DataWrite[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
|
5289
|
5297
|
EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&DataWrite[0],sizeof(BLUESTATUS_st));
|
5290
|
5298
|
}
|
|
@@ -6106,23 +6114,24 @@ void ADC_Sampling_Func(){
|
6106
|
6114
|
Total_SamplingCnt = 5;
|
6107
|
6115
|
}
|
6108
|
6116
|
#else
|
|
6117
|
+uint32_t Adc1_ret[ADC1_CNT] = {0,};
|
|
6118
|
+uint16_t Adc1_arrange[ADC1_CNT] = {0,};
|
|
6119
|
+uint16_t Adc1_HFR_Array[ADC1_CNT][6] = {0,};
|
|
6120
|
+uint16_t Adc1_HFR_Desc_Array[ADC1_CNT][6] = {0,};
|
|
6121
|
+uint32_t Adc1_HFR_Ret[ADC1_CNT]= {0,};
|
|
6122
|
+
|
|
6123
|
+uint32_t Adc3_ret[ADC3_CNT] = {0,};
|
|
6124
|
+uint16_t Adc3_arrange[ADC3_CNT] = {0,};
|
|
6125
|
+uint16_t Adc3_HFR_Array[ADC3_CNT][6] = {0,};
|
|
6126
|
+uint16_t Adc3_HFR_Desc_Array[ADC3_CNT][6] = {0,};
|
|
6127
|
+uint32_t Adc3_HFR_Ret[ADC3_CNT]= {0,};
|
|
6128
|
+
|
|
6129
|
+uint8_t Sampling_Cnt = 0; // 1cbt 100ms
|
|
6130
|
+uint8_t Total_SamplingCnt = 0; // 6 Cnt - 600ms
|
|
6131
|
+#if 0 // PYJ.2020.08.11_BEGIN --
|
6109
|
6132
|
void ADC_Sampling_Func(){
|
6110
|
6133
|
uint8_t ret = ADC_100ms_Cnt % 2;
|
6111
|
6134
|
|
6112
|
|
- static uint32_t Adc1_ret[ADC1_CNT] = {0,};
|
6113
|
|
- static uint16_t Adc1_arrange[ADC1_CNT] = {0,};
|
6114
|
|
- static uint16_t Adc1_HFR_Array[ADC1_CNT][6] = {0,};
|
6115
|
|
- static uint16_t Adc1_HFR_Desc_Array[ADC1_CNT][6] = {0,};
|
6116
|
|
- static uint32_t Adc1_HFR_Ret[ADC1_CNT]= {0,};
|
6117
|
|
-
|
6118
|
|
- static uint32_t Adc3_ret[ADC3_CNT] = {0,};
|
6119
|
|
- static uint16_t Adc3_arrange[ADC3_CNT] = {0,};
|
6120
|
|
- static uint16_t Adc3_HFR_Array[ADC3_CNT][6] = {0,};
|
6121
|
|
- static uint16_t Adc3_HFR_Desc_Array[ADC3_CNT][6] = {0,};
|
6122
|
|
- static uint32_t Adc3_HFR_Ret[ADC3_CNT]= {0,};
|
6123
|
|
-
|
6124
|
|
- static uint8_t Sampling_Cnt = 0; // 1cbt 100ms
|
6125
|
|
- static uint8_t Total_SamplingCnt = 0; // 6 Cnt - 600ms
|
6126
|
6135
|
|
6127
|
6136
|
double ADC1DoubleRet[ADC1_CNT];
|
6128
|
6137
|
double ADC3DoubleRet[ADC3_CNT];
|
|
@@ -6143,6 +6152,9 @@ void ADC_Sampling_Func(){
|
6143
|
6152
|
adc1cnt = 0;
|
6144
|
6153
|
adc3cnt = 0;
|
6145
|
6154
|
Sampling_Cnt++;
|
|
6155
|
+ printf("ADC_100ms_Cnt : %d \r\n",ADC_100ms_Cnt);
|
|
6156
|
+ }else{
|
|
6157
|
+ return;
|
6146
|
6158
|
}
|
6147
|
6159
|
|
6148
|
6160
|
|
|
@@ -6276,6 +6288,192 @@ void ADC_Sampling_Func(){
|
6276
|
6288
|
if(Total_SamplingCnt >= 5)
|
6277
|
6289
|
Total_SamplingCnt = 5;
|
6278
|
6290
|
}
|
|
6291
|
+//#else
|
|
6292
|
+void ADC_Sampling_Func(uint8_t mode,uint16_t Timer2ms_AdcValue,uint8_t index){
|
|
6293
|
+ static uint32_t TempAdc1[ADC1_CNT] = {0,};
|
|
6294
|
+ static uint32_t TempAdc3[ADC3_CNT] = {0,};
|
|
6295
|
+ static uint8_t ADC1_TotalCnt[ADC1_CNT] = {0,} ;
|
|
6296
|
+ static uint8_t ADC3_TotalCnt[ADC3_CNT] = {0,} ;
|
|
6297
|
+
|
|
6298
|
+ static uint8_t ADC1_TotalSamplingCnt[ADC1_CNT] = {0,} ;
|
|
6299
|
+ static uint8_t ADC3_TotalSamplingCnt[ADC3_CNT] = {0,} ;
|
|
6300
|
+ double temp = 0;
|
|
6301
|
+ double ADC1DoubleRet[ADC1_CNT];
|
|
6302
|
+ double ADC3DoubleRet[ADC3_CNT];
|
|
6303
|
+
|
|
6304
|
+
|
|
6305
|
+ if(mode == 1){
|
|
6306
|
+ TempAdc1[index] += Timer2ms_AdcValue;
|
|
6307
|
+ ADC1_TotalCnt[index]++;
|
|
6308
|
+
|
|
6309
|
+ if(ADC1_TotalCnt[index] >= 50){
|
|
6310
|
+ TempAdc1[index] /= ADC1_TotalCnt[index];
|
|
6311
|
+ /* ADC1DoubleRet[index] = ((TempAdc1[index] * 3.3 /4096) * 1000);
|
|
6312
|
+ TempAdc1[index] = ADC1DoubleRet[index];*/
|
|
6313
|
+ /**/
|
|
6314
|
+
|
|
6315
|
+
|
|
6316
|
+ if(ADC1_TotalSamplingCnt[index] == HFR_REQUSET_TOTAL_CNT - 1){
|
|
6317
|
+ ArrayMoveBack(&Adc1_HFR_Array[index][0],HFR_REQUSET_TOTAL_CNT);
|
|
6318
|
+ Adc1_HFR_Array[index][HFR_REQUSET_TOTAL_CNT - 1]
|
|
6319
|
+ = TempAdc1[index];
|
|
6320
|
+ }
|
|
6321
|
+ else{
|
|
6322
|
+ Adc1_HFR_Array[index][ADC1_TotalSamplingCnt[index]]
|
|
6323
|
+ = TempAdc1[index];
|
|
6324
|
+ }
|
|
6325
|
+
|
|
6326
|
+ for(int repl = 0; repl < 6; repl++){
|
|
6327
|
+ Adc1_HFR_Desc_Array[index][repl] = Adc1_HFR_Array[index][repl];
|
|
6328
|
+// if(index == 3)
|
|
6329
|
+// printf("Adc1_HFR_Array[index] : %d \r\n",Adc1_HFR_Array[index][repl]);
|
|
6330
|
+
|
|
6331
|
+ }
|
|
6332
|
+
|
|
6333
|
+ DascendigFunc(&Adc1_HFR_Desc_Array[index][0],HFR_REQUSET_TOTAL_CNT);
|
|
6334
|
+ for(int a = 1; a < 5; a++){
|
|
6335
|
+ Adc1_HFR_Ret[index] += Adc1_HFR_Desc_Array[index][a];
|
|
6336
|
+
|
|
6337
|
+ }
|
|
6338
|
+ Adc1_HFR_Ret[index] /= 4;
|
|
6339
|
+
|
|
6340
|
+ ADC1DoubleRet[index] = ((Adc1_HFR_Ret[index] * 3.3 /4096) * 1000);
|
|
6341
|
+ ADC1Ret[index] = ADC1DoubleRet[index];
|
|
6342
|
+
|
|
6343
|
+
|
|
6344
|
+
|
|
6345
|
+ /**/
|
|
6346
|
+ if(index == 0){
|
|
6347
|
+ bluecell_Currdatastatus.ULO_P1_Level1_H
|
|
6348
|
+ = (((uint16_t)ADC1Ret[index] & 0xFF00) >> 8);
|
|
6349
|
+ bluecell_Currdatastatus.ULO_P1_Level1_L
|
|
6350
|
+ = (((uint16_t)ADC1Ret[index] & 0x00FF) );
|
|
6351
|
+ }
|
|
6352
|
+ else if(index == 1){
|
|
6353
|
+ bluecell_Currdatastatus.ULO_P2_Level2_H
|
|
6354
|
+ = (((uint16_t)ADC1Ret[index] & 0xFF00) >> 8);
|
|
6355
|
+ bluecell_Currdatastatus.ULO_P2_Level2_L
|
|
6356
|
+ = (((uint16_t)ADC1Ret[index] & 0x00FF) );
|
|
6357
|
+ }
|
|
6358
|
+ else if(index == 2){
|
|
6359
|
+
|
|
6360
|
+ bluecell_Currdatastatus.ULO_P3_Level3_H
|
|
6361
|
+ = (((uint16_t)ADC1Ret[index] & 0xFF00) >> 8);
|
|
6362
|
+ bluecell_Currdatastatus.ULO_P3_Level3_L
|
|
6363
|
+ = (((uint16_t)ADC1Ret[index] & 0x00FF) );
|
|
6364
|
+ }
|
|
6365
|
+ /* *
|
|
6366
|
+ 온도 소수점 제거
|
|
6367
|
+ */
|
|
6368
|
+ else if(index == 3){
|
|
6369
|
+// printf("Temp %d \r\n",ADC1Ret[index]);
|
|
6370
|
+ temp = ((uint16_t)ADC1Ret[index] * 0.001);
|
|
6371
|
+ bluecell_Currdatastatus.DET_TEMP = ((temp - 0.5) * 100);
|
|
6372
|
+ bluecell_Currdatastatus.DET_TEMP += bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET;
|
|
6373
|
+ }
|
|
6374
|
+ Adc1_ret[index] = 0;
|
|
6375
|
+ Adc1_arrange[index] = 0;
|
|
6376
|
+ Adc1_HFR_Ret[index] = 0;
|
|
6377
|
+ ADC1_TotalCnt[index] = 0;
|
|
6378
|
+ TempAdc1[index] = 0;
|
|
6379
|
+ ADC1_TotalSamplingCnt[index]++;
|
|
6380
|
+ }
|
|
6381
|
+ }
|
|
6382
|
+ else if(mode == 3){
|
|
6383
|
+ TempAdc3[index] += Timer2ms_AdcValue;
|
|
6384
|
+ ADC3_TotalCnt[index]++;
|
|
6385
|
+
|
|
6386
|
+ if(ADC3_TotalCnt[index] >= 50){
|
|
6387
|
+ TempAdc3[index] /= ADC3_TotalCnt[index];
|
|
6388
|
+// ADC3DoubleRet[index] = ((TempAdc3[index] * 3.3 /4096) * 1000);
|
|
6389
|
+// TempAdc3[index] = ADC3DoubleRet[index];
|
|
6390
|
+
|
|
6391
|
+
|
|
6392
|
+
|
|
6393
|
+/**/
|
|
6394
|
+
|
|
6395
|
+
|
|
6396
|
+ if(ADC3_TotalSamplingCnt[index] == HFR_REQUSET_TOTAL_CNT - 1){
|
|
6397
|
+ ArrayMoveBack(&Adc3_HFR_Array[index][0],HFR_REQUSET_TOTAL_CNT);
|
|
6398
|
+ Adc3_HFR_Array[index][HFR_REQUSET_TOTAL_CNT - 1]
|
|
6399
|
+ = TempAdc3[index];
|
|
6400
|
+ }
|
|
6401
|
+ else{
|
|
6402
|
+ Adc3_HFR_Array[index][ADC3_TotalSamplingCnt[index]]
|
|
6403
|
+ = TempAdc3[index];
|
|
6404
|
+ }
|
|
6405
|
+
|
|
6406
|
+ for(int repl = 0; repl < 6; repl++){
|
|
6407
|
+ Adc3_HFR_Desc_Array[index][repl] = Adc3_HFR_Array[index][repl];
|
|
6408
|
+// if(index == 3)
|
|
6409
|
+// printf("Adc3_HFR_Array[index] : %d \r\n",Adc3_HFR_Array[index][repl]);
|
|
6410
|
+
|
|
6411
|
+ }
|
|
6412
|
+
|
|
6413
|
+ DascendigFunc(&Adc3_HFR_Desc_Array[index][0],HFR_REQUSET_TOTAL_CNT);
|
|
6414
|
+ for(int a = 1; a < 5; a++){
|
|
6415
|
+ Adc3_HFR_Ret[index] += Adc3_HFR_Desc_Array[index][a];
|
|
6416
|
+
|
|
6417
|
+ }
|
|
6418
|
+ Adc3_HFR_Ret[index] /= 4;
|
|
6419
|
+
|
|
6420
|
+ ADC3DoubleRet[index] = ((Adc3_HFR_Ret[index] * 3.3 /4096) * 1000);
|
|
6421
|
+ ADC3Ret[index] = ADC3DoubleRet[index];
|
|
6422
|
+
|
|
6423
|
+
|
|
6424
|
+
|
|
6425
|
+ /**/
|
|
6426
|
+
|
|
6427
|
+ if(index == 1){
|
|
6428
|
+ bluecell_Currdatastatus.DLI_P1_Level1_H
|
|
6429
|
+ = (((uint16_t)TempAdc3[index] & 0xFF00) >> 8);
|
|
6430
|
+ bluecell_Currdatastatus.DLI_P1_Level1_L
|
|
6431
|
+ = (((uint16_t)TempAdc3[index] & 0x00FF));
|
|
6432
|
+ }
|
|
6433
|
+ else if(index == 2){
|
|
6434
|
+ bluecell_Currdatastatus.DLI_P2_Level2_H
|
|
6435
|
+ = (((uint16_t)TempAdc3[index] & 0xFF00) >> 8);
|
|
6436
|
+ bluecell_Currdatastatus.DLI_P2_Level2_L
|
|
6437
|
+ = (((uint16_t)TempAdc3[index] & 0x00FF) );
|
|
6438
|
+ }
|
|
6439
|
+ else if(index == 3){
|
|
6440
|
+ bluecell_Currdatastatus.DLI_P3_Level3_H
|
|
6441
|
+ = (((uint16_t)TempAdc3[index] & 0xFF00) >> 8);
|
|
6442
|
+ bluecell_Currdatastatus.DLI_P3_Level3_L
|
|
6443
|
+ = (((uint16_t)TempAdc3[index] & 0x00FF) );
|
|
6444
|
+ }
|
|
6445
|
+ else if(index == 4){
|
|
6446
|
+ bluecell_Currdatastatus.DLI_P4_Level4_H
|
|
6447
|
+ = (((uint16_t)TempAdc3[index] & 0xFF00) >> 8);
|
|
6448
|
+ bluecell_Currdatastatus.DLI_P4_Level4_L
|
|
6449
|
+ = (((uint16_t)TempAdc3[index] & 0x00FF) );
|
|
6450
|
+ }
|
|
6451
|
+ else if(index == 0){
|
|
6452
|
+ bluecell_Currdatastatus.ULO_P4_Level4_H
|
|
6453
|
+ = (((uint16_t)TempAdc3[index] & 0xFF00) >> 8);
|
|
6454
|
+ bluecell_Currdatastatus.ULO_P4_Level4_L
|
|
6455
|
+ = (((uint16_t)TempAdc3[index] & 0x00FF) );
|
|
6456
|
+ }
|
|
6457
|
+ Adc3_ret[index] = 0;
|
|
6458
|
+ Adc3_arrange[index] = 0;
|
|
6459
|
+ Adc3_HFR_Ret[index] = 0;
|
|
6460
|
+ ADC3_TotalCnt[index] = 0;
|
|
6461
|
+ TempAdc3[index] = 0;
|
|
6462
|
+ ADC3_TotalSamplingCnt[index]++;
|
|
6463
|
+
|
|
6464
|
+ }
|
|
6465
|
+
|
|
6466
|
+ }
|
|
6467
|
+
|
|
6468
|
+ if(ADC1_TotalSamplingCnt[index] >= 5)
|
|
6469
|
+ ADC1_TotalSamplingCnt[index] = 5;
|
|
6470
|
+ if(ADC3_TotalSamplingCnt[index] >= 5)
|
|
6471
|
+ ADC3_TotalSamplingCnt[index] = 5;
|
|
6472
|
+
|
|
6473
|
+
|
|
6474
|
+}
|
|
6475
|
+
|
|
6476
|
+#endif // PYJ.2020.08.11_END --
|
6279
|
6477
|
|
6280
|
6478
|
|
6281
|
6479
|
#endif // PYJ.2020.08.07_END --
|
|
@@ -6299,7 +6497,10 @@ void ADC_Check(void){
|
6299
|
6497
|
// printf("%d\r\n",ADC_100ms_Cnt);
|
6300
|
6498
|
// }
|
6301
|
6499
|
|
6302
|
|
- if(adc3cnt >= ADC_AVERAGECNT){
|
|
6500
|
+// if(adc3cnt >= ADC_AVERAGECNT){
|
|
6501
|
+ if(ADC_100ms_Cnt >= 100){
|
|
6502
|
+ ADC_100ms_Cnt = 0;
|
|
6503
|
+ printf("adc3cnt : %d \r\n",adc3cnt);
|
6303
|
6504
|
#if 1 // PYJ.2020.05.25_BEGIN --
|
6304
|
6505
|
for(int i = 0; i < ADC3_CNT; i++){
|
6305
|
6506
|
DascendigFunc(&ADC3valuearray[i][0],ADC_AVERAGECNT);
|
|
@@ -6404,10 +6605,145 @@ void ADC_Check(void){
|
6404
|
6605
|
adc1cnt = 0;
|
6405
|
6606
|
|
6406
|
6607
|
}
|
|
6608
|
+#else
|
|
6609
|
+ //static uint8_t Cnt = 0;
|
|
6610
|
+ double ADC1DoubleRet[4];
|
|
6611
|
+ double ADC3DoubleRet[5];
|
|
6612
|
+ uint32_t ADC1_Average_value[ADC1_CNT];
|
|
6613
|
+ static uint32_t HFR_ADC1_Average_value[ADC1_CNT];
|
|
6614
|
+ uint32_t ADC3_Average_value[ADC3_CNT];
|
|
6615
|
+
|
|
6616
|
+ // double ret = 0;
|
|
6617
|
+ uint16_t MIN_ADC[ADC3_CNT] = {0,};
|
|
6618
|
+ uint16_t cnt[ADC3_CNT] = {0,};
|
|
6619
|
+ double temp;
|
|
6620
|
+// if(AdcTimerCnt > 10){
|
|
6621
|
+ // 정렬할 배열, 요소 개수, 요소 크기, 비교 함수를 넣어줌
|
|
6622
|
+//
|
|
6623
|
+// if(ADC_100ms_Cnt >= 100){
|
|
6624
|
+// printf("%d\r\n",ADC_100ms_Cnt);
|
|
6625
|
+// }
|
|
6626
|
+
|
|
6627
|
+// if(adc3cnt >= ADC_AVERAGECNT){
|
|
6628
|
+ if(ADC_100ms_Cnt >= 100){
|
|
6629
|
+
|
|
6630
|
+ // printf("adc3cnt : %d \r\n",adc3cnt);
|
|
6631
|
+ for(int i = 0; i < ADC3_CNT; i++){
|
|
6632
|
+ ADC3DoubleRet[i] = HFR_ADC3value[i] / adc3cnt;
|
|
6633
|
+
|
|
6634
|
+ Adc3_HFR_Array[i][Total_SamplingCnt] = ADC3DoubleRet[i];
|
|
6635
|
+ if(Total_SamplingCnt == HFR_REQUSET_TOTAL_CNT - 1){
|
|
6636
|
+ ArrayMoveBack(&Adc3_HFR_Array[i][0],HFR_REQUSET_TOTAL_CNT);
|
|
6637
|
+ }
|
|
6638
|
+ for(int repl = 0; repl < 6; repl++){
|
|
6639
|
+ Adc3_HFR_Desc_Array[i][repl] = Adc3_HFR_Array[i][repl];
|
|
6640
|
+
|
|
6641
|
+ }
|
|
6642
|
+ DascendigFunc(&Adc3_HFR_Desc_Array[i][0],HFR_REQUSET_TOTAL_CNT);
|
|
6643
|
+ for(int a = 1; a < 5; a++){
|
|
6644
|
+ Adc3_HFR_Ret[i] += Adc3_HFR_Desc_Array[i][a];
|
|
6645
|
+
|
|
6646
|
+ }
|
|
6647
|
+ Adc3_HFR_Ret[i] /= 4;
|
|
6648
|
+ ADC3DoubleRet[i] = ((Adc3_HFR_Ret[i] * 3.3 /4096) * 1000);
|
|
6649
|
+ ADC3Ret[i] = ADC3DoubleRet[i];
|
|
6650
|
+ Adc3_HFR_Ret[i] = 0;
|
|
6651
|
+ HFR_ADC3value[i] =0 ;
|
|
6652
|
+ }
|
|
6653
|
+ bluecell_Currdatastatus.DLI_P1_Level1_H
|
|
6654
|
+ = ((ADC3Ret[1] & 0xFF00) >> 8);
|
|
6655
|
+ bluecell_Currdatastatus.DLI_P1_Level1_L
|
|
6656
|
+ = ((ADC3Ret[1] & 0x00FF));
|
|
6657
|
+
|
|
6658
|
+
|
|
6659
|
+ bluecell_Currdatastatus.DLI_P2_Level2_H
|
|
6660
|
+ = ((ADC3Ret[2] & 0xFF00) >> 8);
|
|
6661
|
+ bluecell_Currdatastatus.DLI_P2_Level2_L
|
|
6662
|
+ = ((ADC3Ret[2] & 0x00FF) );
|
|
6663
|
+
|
|
6664
|
+
|
|
6665
|
+ bluecell_Currdatastatus.DLI_P3_Level3_H
|
|
6666
|
+ = ((ADC3Ret[3] & 0xFF00) >> 8);
|
|
6667
|
+ bluecell_Currdatastatus.DLI_P3_Level3_L
|
|
6668
|
+ = ((ADC3Ret[3] & 0x00FF) );
|
|
6669
|
+
|
|
6670
|
+
|
|
6671
|
+ bluecell_Currdatastatus.DLI_P4_Level4_H
|
|
6672
|
+ = ((ADC3Ret[4] & 0xFF00) >> 8);
|
|
6673
|
+ bluecell_Currdatastatus.DLI_P4_Level4_L
|
|
6674
|
+ = ((ADC3Ret[4] & 0x00FF) );
|
|
6675
|
+
|
|
6676
|
+
|
|
6677
|
+ bluecell_Currdatastatus.ULO_P4_Level4_H
|
|
6678
|
+ = ((ADC3Ret[0] & 0xFF00) >> 8);
|
|
6679
|
+ bluecell_Currdatastatus.ULO_P4_Level4_L
|
|
6680
|
+ = ((ADC3Ret[0] & 0x00FF) );
|
|
6681
|
+
|
|
6682
|
+
|
|
6683
|
+ for(int i = 0; i < ADC1_CNT; i++){
|
|
6684
|
+ ADC1DoubleRet[i] = HFR_ADC1value[i] / adc1cnt;
|
|
6685
|
+ Adc1_HFR_Array[i][Total_SamplingCnt] = ADC1DoubleRet[i];
|
|
6686
|
+ if(Total_SamplingCnt == HFR_REQUSET_TOTAL_CNT - 1){
|
|
6687
|
+ ArrayMoveBack(&Adc1_HFR_Array[i][0],HFR_REQUSET_TOTAL_CNT);
|
|
6688
|
+ }
|
|
6689
|
+ for(int repl = 0; repl < 6; repl++){
|
|
6690
|
+ Adc1_HFR_Desc_Array[i][repl] = Adc1_HFR_Array[i][repl];
|
|
6691
|
+
|
|
6692
|
+ }
|
|
6693
|
+ DascendigFunc(&Adc1_HFR_Desc_Array[i][0],HFR_REQUSET_TOTAL_CNT);
|
|
6694
|
+ for(int a = 1; a < 5; a++){
|
|
6695
|
+ Adc1_HFR_Ret[i] += Adc1_HFR_Desc_Array[i][a];
|
|
6696
|
+
|
|
6697
|
+ }
|
|
6698
|
+ Adc1_HFR_Ret[i] /= 4;
|
|
6699
|
+ ADC1DoubleRet[i] = ((Adc1_HFR_Ret[i] * 3.3 /4096) * 1000);
|
|
6700
|
+ ADC1Ret[i] = ADC1DoubleRet[i];
|
|
6701
|
+ Adc1_HFR_Ret[i] = 0;
|
|
6702
|
+ HFR_ADC1value[i] = 0;
|
|
6703
|
+ }
|
|
6704
|
+ bluecell_Currdatastatus.ULO_P1_Level1_H
|
|
6705
|
+ = ((ADC1Ret[0] & 0xFF00) >> 8);
|
|
6706
|
+ bluecell_Currdatastatus.ULO_P1_Level1_L
|
|
6707
|
+ = ((ADC1Ret[0] & 0x00FF) );
|
|
6708
|
+
|
|
6709
|
+
|
|
6710
|
+ bluecell_Currdatastatus.ULO_P2_Level2_H
|
|
6711
|
+ = ((ADC1Ret[1] & 0xFF00) >> 8);
|
|
6712
|
+ bluecell_Currdatastatus.ULO_P2_Level2_L
|
|
6713
|
+ = ((ADC1Ret[1] & 0x00FF) );
|
|
6714
|
+
|
|
6715
|
+
|
|
6716
|
+ bluecell_Currdatastatus.ULO_P3_Level3_H
|
|
6717
|
+ = ((ADC1Ret[2] & 0xFF00) >> 8);
|
|
6718
|
+ bluecell_Currdatastatus.ULO_P3_Level3_L
|
|
6719
|
+ = ((ADC1Ret[2] & 0x00FF) );
|
|
6720
|
+
|
|
6721
|
+/* *
|
|
6722
|
+온도 소수점 제거
|
|
6723
|
+*/
|
|
6724
|
+ temp = (ADC1Ret[3] * 0.001);
|
|
6725
|
+ bluecell_Currdatastatus.DET_TEMP = ((temp - 0.5) * 100);
|
|
6726
|
+ bluecell_Currdatastatus.DET_TEMP += bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET;
|
|
6727
|
+
|
|
6728
|
+
|
|
6729
|
+ Total_SamplingCnt++;
|
|
6730
|
+
|
|
6731
|
+ if(Total_SamplingCnt >=5)
|
|
6732
|
+ Total_SamplingCnt = 5;
|
|
6733
|
+
|
|
6734
|
+ adc3cnt = 0;
|
|
6735
|
+ adc1cnt = 0;
|
|
6736
|
+ ADC_100ms_Cnt = 0;
|
|
6737
|
+
|
|
6738
|
+ }
|
|
6739
|
+
|
6407
|
6740
|
#endif // PYJ.2020.08.07_END --
|
|
6741
|
+// ADC_Sampling_Func();
|
|
6742
|
+
|
6408
|
6743
|
/*
|
6409
|
6744
|
After ADC calculation is completed, start Det Alarm check.
|
6410
|
6745
|
*/
|
|
6746
|
+
|
6411
|
6747
|
DET_LevelAlarmCheck();/*DL UL Alarm Check*/
|
6412
|
6748
|
}
|
6413
|
6749
|
|