浏览代码

ADC Data 수집 Cnt 500 -> 100으로 변경

PYJ 5 年之前
父节点
当前提交
c63198bde3
共有 4 个文件被更改,包括 12 次插入19 次删除
  1. 2 3
      Bluecell_Src/Bluecell_operate.c
  2. 7 7
      Bluecell_Src/uart.c
  3. 1 1
      Inc/main.h
  4. 2 8
      Src/main.c

+ 2 - 3
Bluecell_Src/Bluecell_operate.c

@@ -2532,7 +2532,6 @@ bool MBIC_Operate(uint8_t* data){
2532
 
2532
 
2533
     data[MBIC_ERRRESPONSE_0] = MBIC_ERRRESPONSE;
2533
     data[MBIC_ERRRESPONSE_0] = MBIC_ERRRESPONSE;
2534
 
2534
 
2535
-
2536
     if(cmd == MBIC_GET){
2535
     if(cmd == MBIC_GET){
2537
         data[MBIC_CMD_0] = 0x80;//MBIC_ERRRESPONSE;
2536
         data[MBIC_CMD_0] = 0x80;//MBIC_ERRRESPONSE;
2538
         Length = MBIC_DataSend(data);
2537
         Length = MBIC_DataSend(data);
@@ -3096,7 +3095,7 @@ void ADC_Check(void){
3096
 
3095
 
3097
 
3096
 
3098
 
3097
 
3099
-    if(adc3cnt >= 500){
3098
+    if(adc3cnt >= ADC_AVERAGECNT){
3100
 //        printf("%f\r\n",ADC3value[4]*3.3/4095);
3099
 //        printf("%f\r\n",ADC3value[4]*3.3/4095);
3101
 #if 1 // PYJ.2020.05.25_BEGIN -- 
3100
 #if 1 // PYJ.2020.05.25_BEGIN -- 
3102
       for(int i = 0; i < ADC3_CNT; i++){
3101
       for(int i = 0; i < ADC3_CNT; i++){
@@ -3169,7 +3168,7 @@ void ADC_Check(void){
3169
 
3168
 
3170
     }
3169
     }
3171
 
3170
 
3172
-    if(adc1cnt >= 500){ 
3171
+    if(adc1cnt >= ADC_AVERAGECNT){ 
3173
         for(int i = 0; i < ADC1_CNT; i++){
3172
         for(int i = 0; i < ADC1_CNT; i++){
3174
             DascendigFunc(&ADC1valuearray[i][0],ADC_AVERAGECNT);
3173
             DascendigFunc(&ADC1valuearray[i][0],ADC_AVERAGECNT);
3175
             MIN_ADC[i] = ADC1valuearray[i][0] - 12;
3174
             MIN_ADC[i] = ADC1valuearray[i][0] - 12;

+ 7 - 7
Bluecell_Src/uart.c

@@ -91,7 +91,7 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
91
 //        printf("data cnt zero !!!  \r\n");
91
 //        printf("data cnt zero !!!  \r\n");
92
         //RF_Ctrl_Main(&uart_buf[Header]);
92
         //RF_Ctrl_Main(&uart_buf[Header]);
93
 //        HAL_UART_Transmit(dst, &temp_buf[BLUECELL_HEADER00], 11, 3000);
93
 //        HAL_UART_Transmit(dst, &temp_buf[BLUECELL_HEADER00], 11, 3000);
94
-#if 1 // PYJ.2019.07.15_BEGIN --
94
+#if 0 // PYJ.2019.07.15_BEGIN --
95
             for(int i = 0; i < cnt; i++){
95
             for(int i = 0; i < cnt; i++){
96
                 printf("%02x ",uart_buf[i]);
96
                 printf("%02x ",uart_buf[i]);
97
             }
97
             }
@@ -122,17 +122,17 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
122
 
122
 
123
 }
123
 }
124
 void Uart_Check(void){
124
 void Uart_Check(void){
125
-  while (TerminalQueue.data > 0 && UartRxTimerCnt > 50) GetDataFromUartQueue(&hTerminal);
125
+  while (TerminalQueue.data > 0 && UartRxTimerCnt > 10) GetDataFromUartQueue(&hTerminal);
126
 }
126
 }
127
 
127
 
128
 void Uart1_Data_Send(uint8_t* data,uint16_t size){
128
 void Uart1_Data_Send(uint8_t* data,uint16_t size){
129
     HAL_UART_Transmit_DMA(&hTerminal, data,size); 
129
     HAL_UART_Transmit_DMA(&hTerminal, data,size); 
130
     
130
     
131
-    printf("\r\n [TX]  ");
132
-    for(int i = 0; i< size; i++)
133
-        printf(" %02x",data[i]);
134
-    printf("COUNT : %d",size);
135
-    printf("\r\n");
131
+//    printf("\r\n [TX]  ");
132
+//    for(int i = 0; i< size; i++)
133
+//        printf(" %02x",data[i]);
134
+//    printf("COUNT : %d",size);
135
+//    printf("\r\n");
136
     
136
     
137
 }
137
 }
138
 
138
 

+ 1 - 1
Inc/main.h

@@ -179,7 +179,7 @@ extern I2C_HandleTypeDef hi2c2;
179
 
179
 
180
 #define MBIC_OFF_MAINTAIN_SEC 10000
180
 #define MBIC_OFF_MAINTAIN_SEC 10000
181
 
181
 
182
-#define ADC_AVERAGECNT 500
182
+#define ADC_AVERAGECNT 100
183
 #define ADC1_CNT 4
183
 #define ADC1_CNT 4
184
 #define ADC3_CNT 5
184
 #define ADC3_CNT 5
185
 
185
 

+ 2 - 8
Src/main.c

@@ -161,7 +161,7 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
161
 
161
 
162
     if(hadc->Instance == hadc1.Instance)
162
     if(hadc->Instance == hadc1.Instance)
163
     {
163
     {
164
-        if(adc1cnt < 500){
164
+        if(adc1cnt < ADC_AVERAGECNT){
165
             for(int i = 0; i < 4; i++){
165
             for(int i = 0; i < 4; i++){
166
                 ADC1valuearray[i][adc1cnt] = ADC1value[i];
166
                 ADC1valuearray[i][adc1cnt] = ADC1value[i];
167
             }
167
             }
@@ -170,7 +170,7 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
170
     }
170
     }
171
     if(hadc->Instance == hadc3.Instance)
171
     if(hadc->Instance == hadc3.Instance)
172
     {
172
     {
173
-        if(adc3cnt < 500){
173
+        if(adc3cnt < ADC_AVERAGECNT){
174
             for(int i = 0; i < 5; i++){
174
             for(int i = 0; i < 5; i++){
175
                 ADC3valuearray[i][adc3cnt] = ADC3value[i];
175
                 ADC3valuearray[i][adc3cnt] = ADC3value[i];
176
             }
176
             }
@@ -364,7 +364,6 @@ int main(void)
364
     printf("****************************************\r\n");
364
     printf("****************************************\r\n");
365
 #endif // PYJ.2020.05.06_END --   
365
 #endif // PYJ.2020.05.06_END --   
366
   Booting_LedInit();
366
   Booting_LedInit();
367
-
368
   Booting_LED_Check();
367
   Booting_LED_Check();
369
 #if 0 // PYJ.2020.04.22_BEGIN -- 
368
 #if 0 // PYJ.2020.04.22_BEGIN -- 
370
   EEPROM_M24C08_write(0xA0,0,i2cTestData,1);
369
   EEPROM_M24C08_write(0xA0,0,i2cTestData,1);
@@ -382,18 +381,14 @@ int main(void)
382
 //    EEPROMTEST_J();
381
 //    EEPROMTEST_J();
383
 //    eepromtest_j1();
382
 //    eepromtest_j1();
384
 //        eepromtest_j1();
383
 //        eepromtest_j1();
385
-
386
 //  uint8_t retdate[10] = {0,1,2,3,4,5,6,7,8,9};
384
 //  uint8_t retdate[10] = {0,1,2,3,4,5,6,7,8,9};
387
 //    uint16_t rrrrrr = 0;
385
 //    uint16_t rrrrrr = 0;
388
 //  rrrrrr = ((CRC16_Generate(&retdate[0], 10)));  
386
 //  rrrrrr = ((CRC16_Generate(&retdate[0], 10)));  
389
-  
390
 //  printf("CRC : %x \r\n",rrrrrr);
387
 //  printf("CRC : %x \r\n",rrrrrr);
391
-
392
   while (1)
388
   while (1)
393
   {
389
   {
394
 //	  HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14);
390
 //	  HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14);
395
   //   printf("data %d\r\n",LedTimerCnt);
391
   //   printf("data %d\r\n",LedTimerCnt);
396
-
397
     Boot_LED_Toggle(); /*LED Check*/
392
     Boot_LED_Toggle(); /*LED Check*/
398
     Uart_Check();      /*Usart Rx*/
393
     Uart_Check();      /*Usart Rx*/
399
     ADC_Check();       /*Det Calc + DL/UL Alarm Check Function*/
394
     ADC_Check();       /*Det Calc + DL/UL Alarm Check Function*/
@@ -402,7 +397,6 @@ int main(void)
402
     Alarm_Check();     /*Function to check all alarm status variables*/
397
     Alarm_Check();     /*Function to check all alarm status variables*/
403
 //    Uart1_Data_Send("A",1);
398
 //    Uart1_Data_Send("A",1);
404
 //    HAL_Delay(500);
399
 //    HAL_Delay(500);
405
-
406
     /* USER CODE END WHILE */
400
     /* USER CODE END WHILE */
407
 
401
 
408
     /* USER CODE BEGIN 3 */
402
     /* USER CODE BEGIN 3 */