ソースを参照

repair temperature measurement function

terry 2 年 前
コミット
2ef9e11a90
共有15 個のファイルを変更した2312 個の追加263 個の削除を含む
  1. 2 1
      Core/Inc/main.h
  2. 2 0
      Core/Inc/stm32f1xx_it.h
  3. 1 1
      Core/Inc/usart.h
  4. 141 12
      Core/Src/adc.c
  5. 3 0
      Core/Src/dma.c
  6. 16 2
      Core/Src/gpio.c
  7. 3 2
      Core/Src/iap.c
  8. 0 1
      Core/Src/main.c
  9. 35 0
      Core/Src/stm32f1xx_it.c
  10. 0 1
      Core/Src/usart.c
  11. 2049 184
      MDK-ARM/iocollect.uvguix.Administrator
  12. 27 44
      MDK-ARM/iocollect.uvoptx
  13. 12 12
      MDK-ARM/iocollect.uvprojx
  14. 13 1
      iocollect.ioc
  15. 8 2
      readme.md

+ 2 - 1
Core/Inc/main.h

@@ -62,7 +62,7 @@ extern "C" {
 /* Exported macro ------------------------------------------------------------*/
 /* USER CODE BEGIN EM */
 #define Rx_Max 1024  	
-#define Version_sys 0x23060800  	
+#define Version_sys 0x23062500  	
 
 extern uint16_t Adc2_CalibrationValue ;
 extern uint16_t Adc3_CalibrationValue ;
@@ -95,6 +95,7 @@ void reboot_sys(void);
 #define DEBOUNCE_COUNT 10
 #define Modbus 1
 
+#define newline 0
 #define ADDR_FLASH_PAGE_94    ((uint32_t)0x802F000)  // Flash扇区94页的起始地址      address
 #define ADDR_FLASH_PAGE_104   ((uint32_t)0x8034000)  // Flash扇区104页的起始地址     PbStatus
 #define ADDR_FLASH_PAGE_114   ((uint32_t)0x8039000)  // Flash扇区114页的起始地址     Baudrate

+ 2 - 0
Core/Inc/stm32f1xx_it.h

@@ -52,8 +52,10 @@ void MemManage_Handler(void);
 void BusFault_Handler(void);
 void UsageFault_Handler(void);
 void DebugMon_Handler(void);
+void DMA1_Channel1_IRQHandler(void);
 void DMA1_Channel3_IRQHandler(void);
 void DMA1_Channel5_IRQHandler(void);
+void ADC1_2_IRQHandler(void);
 void TIM2_IRQHandler(void);
 void TIM3_IRQHandler(void);
 void USART1_IRQHandler(void);

+ 1 - 1
Core/Inc/usart.h

@@ -39,7 +39,7 @@ extern UART_HandleTypeDef huart3;
 /* USER CODE BEGIN Private defines */
 #define BUF_SIZE 500
 #define Uart1_BUF_SIZE  256
-#define Uart2_BUF_SIZE  1024      /*为UART2、3专门开一个DMA接收存储区 2021-4-12 by Daiyf*/
+#define Uart2_BUF_SIZE  1024     /*为UART2、3专门开一个DMA接收存储区 2021-4-12 by Daiyf*/
 #define Uart3_BUF_SIZE  256
 	 
 extern uint8_t usart1_rx_flag;

+ 141 - 12
Core/Src/adc.c

@@ -25,6 +25,7 @@ float CalculateTemperature(uint16_t adc_value, float vref);
 /* USER CODE END 0 */
 
 ADC_HandleTypeDef hadc1;
+DMA_HandleTypeDef hdma_adc1;
 
 /* ADC1 init function */
 void MX_ADC1_Init(void)
@@ -110,6 +111,26 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
     GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
     HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
+    /* ADC1 DMA Init */
+    /* ADC1 Init */
+    hdma_adc1.Instance = DMA1_Channel1;
+    hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY;
+    hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE;
+    hdma_adc1.Init.MemInc = DMA_MINC_ENABLE;
+    hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
+    hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
+    hdma_adc1.Init.Mode = DMA_CIRCULAR;
+    hdma_adc1.Init.Priority = DMA_PRIORITY_LOW;
+    if (HAL_DMA_Init(&hdma_adc1) != HAL_OK)
+    {
+      Error_Handler();
+    }
+
+    __HAL_LINKDMA(adcHandle,DMA_Handle,hdma_adc1);
+
+    /* ADC1 interrupt Init */
+    HAL_NVIC_SetPriority(ADC1_2_IRQn, 5, 0);
+    HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
   /* USER CODE BEGIN ADC1_MspInit 1 */
 
   /* USER CODE END ADC1_MspInit 1 */
@@ -134,6 +155,11 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
     */
     HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2);
 
+    /* ADC1 DMA DeInit */
+    HAL_DMA_DeInit(adcHandle->DMA_Handle);
+
+    /* ADC1 interrupt Deinit */
+    HAL_NVIC_DisableIRQ(ADC1_2_IRQn);
   /* USER CODE BEGIN ADC1_MspDeInit 1 */
 
   /* USER CODE END ADC1_MspDeInit 1 */
@@ -184,12 +210,123 @@ void ApplyFilter(uint16_t raw_data, uint16_t* filtered_data, uint16_t* raw_data_
     *buffer_index = (*buffer_index + 1) % FILTER_LENGTH;	//指向最旧的
 }
 
+
+//#define R_NOMINAL 10000.0f   // 注册时NTC热敏电阻的阻值
+//#define T_NOMINAL 298.15f    // 注册时NTC热敏电阻的温度值,转化为开尔文温标
+//#define B_FACTOR  3950.0f    // NTC热敏电阻的B参数
+//float CalculateTemperature(uint16_t adc_value, float vref)
+//{
+//    float voltage = adc_value * vref / 4096.0f;   // 根据ADC值计算输入电压
+//    float resistance = R_NOMINAL * (voltage / (vref - voltage));   // 根据电压计算NTC热敏电阻阻值
+//    
+//    float steinhart = log(resistance / R_NOMINAL) / B_FACTOR + 1.0f / T_NOMINAL;   // 根据瑞利恒式计算温度
+//    float temperature = 1.0f / steinhart - 273.15f;   // 转换为摄氏温度
+//	return temperature;
+//}
+
+float array1[] = {-40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, 
+                    -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, 
+                    -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, 
+                    -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 
+                    4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
+                    17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 
+                    29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 
+                    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 
+                    53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 
+                    65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 
+                    77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 
+                    89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 
+                    101, 102, 103, 104, 105};
+                    
+float array2[] = {340.9281f, 318.8772f, 298.3978f, 279.3683f, 261.6769f, 
+                  245.2212f, 229.9072f, 215.6488f, 202.3666f, 189.9878f, 
+                  178.4456f, 167.6783f, 157.6292f, 148.2460f, 139.4807f, 
+                  131.2888f, 123.6294f, 116.4648f, 109.7600f, 103.4829f, 
+                  97.6037f, 92.0947f, 86.9305f, 82.0877f, 77.5442f, 73.2798f, 
+                  69.2759f, 65.5149f, 61.9809f, 58.6587f, 55.5345f, 52.5954f, 
+                  49.8294f, 47.2253f, 44.7727f, 42.4620f, 40.2841f, 38.2307f, 
+                  36.2940f, 34.4668f, 32.7421f, 31.1138f, 29.5759f, 28.1229f, 
+                  26.7496f, 25.4513f, 24.2234f, 23.0618f, 21.9625f, 20.9218f, 
+                  19.9364f, 19.0029f, 18.1184f, 17.2800f, 16.4852f, 15.7313f, 
+                  15.0161f, 14.3375f, 13.6932f, 13.0815f, 12.5005f, 11.9485f, 
+                  11.4239f, 10.9252f, 10.4510f, 10.0000f, 9.5709f, 9.1626f, 
+                  8.7738f, 8.4037f, 8.0512f, 7.7154f, 7.3954f, 7.0904f, 6.7996f, 
+                  6.5223f, 6.2577f, 6.0053f, 5.7645f, 5.5345f, 5.3150f, 5.1053f, 
+                  4.9050f, 4.7136f, 4.5307f, 4.3558f, 4.1887f, 4.0287f, 3.8758f, 
+                  3.7294f, 3.5893f, 3.4553f, 3.3269f, 3.2039f, 3.0862f, 2.9733f, 
+                  2.8652f, 2.7616f, 2.6622f, 2.5669f, 2.4755f, 2.3879f, 2.3038f, 
+                  2.2231f, 2.1456f, 2.0712f, 1.9998f, 1.9312f, 1.8653f, 1.8019f, 
+                  1.7411f, 1.6826f, 1.6264f, 1.5723f, 1.5203f, 1.4703f, 1.4222f, 
+                  1.3759f, 1.3313f, 1.2884f, 1.2471f, 1.2073f, 1.1690f, 1.1321f, 
+                  1.0965f, 1.0623f, 1.0293f, 0.9974f, 0.9667f, 0.9372f, 0.9086f, 
+                  0.8811f, 0.8545f, 0.8289f, 0.8042f, 0.7803f, 0.7572f, 0.7350f, 
+                  0.7135f, 0.6927f, 0.6727f, 0.6533f, 0.6346f, 0.6165f, 0.5990f, 
+                  0.5821f};
+float resArr[10];
+float tempArr[10];
+uint16_t temperature1 = 0;
+uint8_t temp = 0;
+				  
+void findIndexAndTemp(float resistance, float array1[], float array2[], int index2, int index1){
+	
+    float resRange = (array2[index2] - array2[index2+1]) / 10.0f;
+    for(int i=0; i<10; i++){
+        resArr[i] = array2[index2+1] + i * resRange;
+    }
+    int index = -1; 
+    float minDiff = 1000.0f; 
+    for(int i=0; i<10; i++){
+        float diff = fabs(resistance - resArr[i]);
+        if(diff < minDiff){
+            minDiff = diff;
+            index = i;
+        }
+    }
+    for(int i = 0; i < 10; i++){
+        tempArr[i] = array1[index1] + i * 0.1; 
+    }
+    temperature1 = tempArr[index];
+	
+    if( resArr[index] < 0){
+        temp = fabs(tempArr[index]);
+        temperature1 = temp | 0x8000;
+    }
+	temperature1 *=10;
+}
+				  
+#define R_NOMINAL 10.0f   // 注册时NTC热敏电阻的阻值
+#define T_NOMINAL 298.15f    // 注册时NTC热敏电阻的温度值,转化为开尔文温标
+#define B_FACTOR  3950.0f    // NTC热敏电阻的B参数
+float CalculateTemperature(uint16_t adc_value, float vref)
+{
+    float voltage = adc_value * vref / 4096.0f;   // 根据ADC值计算输入电压
+    float resistance = R_NOMINAL * (voltage / (vref - voltage));   // 根据电压计算NTC热敏电阻阻值
+    
+//	printf("%.3f\n",resistance);
+	
+//	HAL_Delay(500);
+//	printf("%.4f\n",array2[0]);	
+//	printf("%.4f\n",array2[0]);
+	
+	for (int  i = 0; i < sizeof(array2) - 1; i++) {
+	  if (resistance >= array2[i+1] && resistance < array2[i]) {
+		findIndexAndTemp(resistance, array1, array2, i, i);
+		break;
+	  }
+	}
+	
+//	printf("%.3u\n",temperature1);//十进制
+//	printf("%4x\n",temperature1);//十六进制
+	return temperature1;
+}
+
+
 void GetADCResults(ADC_HandleTypeDef* hadc)
 {
     HAL_ADC_Start(&hadc1);
     HAL_ADC_PollForConversion(&hadc1, 100);
     uint16_t adc1_raw = HAL_ADC_GetValue(&hadc1);
-    float temperature = CalculateTemperature(adc1_raw, 3.3) * 10 - 40;
+	uint16_t temperature = CalculateTemperature(adc1_raw, 3.3);
     ApplyFilter((uint16_t)temperature, &adc1_filtered, adc1_raw_buffer, &adc1_raw_buffer_index);
     
     HAL_ADC_Start(&hadc1);
@@ -209,24 +346,16 @@ void GetADCResults(ADC_HandleTypeDef* hadc)
         adc3_raw += (Value_old_addr3 & 0x8000) ? Adc3_CalibrationValue : -Adc3_CalibrationValue;
     }
     ApplyFilter(adc3_raw, &adc3_filtered, adc3_raw_buffer, &adc3_raw_buffer_index);
-    
+	
     adc1_byte1 = (uint8_t)(adc1_filtered >> 8);
     adc1_byte2 = (uint8_t)(adc1_filtered);
     adc2_byte1 = (uint8_t)(adc2_filtered >> 8);
     adc2_byte2 = (uint8_t)(adc2_filtered);
     adc3_byte1 = (uint8_t)(adc3_filtered >> 8);
     adc3_byte2 = (uint8_t)(adc3_filtered);
+
 }
 
 
-#define R_NOMINAL 10000.0f   // 注册时NTC热敏电阻的阻值
-#define T_NOMINAL 298.15f    // 注册时NTC热敏电阻的温度值,转化为开尔文温标
-#define B_FACTOR 3950.0f     // NTC热敏电阻的B参数
-float CalculateTemperature(uint16_t adc_value, float vref)
-{
-    float voltage = adc_value * vref / 4095.0f;   // 根据ADC值计算输入电压
-    float resistance = R_NOMINAL * (voltage / (vref - voltage));   // 根据电压计算NTC热敏电阻阻值
-    float steinhart = log(resistance / R_NOMINAL) / B_FACTOR + 1.0f / T_NOMINAL;   // 根据瑞利恒式计算温度
-    return 1.0f / steinhart - 273.15f;   // 转换为摄氏温度并返回
-}
+
 /* USER CODE END 1 */

+ 3 - 0
Core/Src/dma.c

@@ -43,6 +43,9 @@ void MX_DMA_Init(void)
   __HAL_RCC_DMA1_CLK_ENABLE();
 
   /* DMA interrupt init */
+  /* DMA1_Channel1_IRQn interrupt configuration */
+  HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 5, 0);
+  HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
   /* DMA1_Channel3_IRQn interrupt configuration */
   HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 5, 0);
   HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn);

+ 16 - 2
Core/Src/gpio.c

@@ -73,10 +73,12 @@ void MX_GPIO_Init(void)
 }
 
 /* USER CODE BEGIN 2 */
+// 定义GPIO_Pin_t结构体
 typedef struct {
     GPIO_TypeDef* port;
     uint16_t pin;
 } GPIO_Pin_t;
+// 定义8个需要处理的引脚
 const GPIO_Pin_t GPIO_PINS[8] = {
     {GPIOA, GPIO_PIN_0},
     {GPIOA, GPIO_PIN_1},
@@ -87,15 +89,27 @@ const GPIO_Pin_t GPIO_PINS[8] = {
     {GPIOA, GPIO_PIN_6},
     {GPIOA, GPIO_PIN_7}
 };
+// 读取引脚状态的函数
+uint8_t ReadPinStatus(GPIO_TypeDef* port, uint16_t pin) {
+    return HAL_GPIO_ReadPin(port, pin) == GPIO_PIN_RESET;
+}
+// 获取输入状态的函数
 uint8_t GetPaInputStatus(void)
 {
     uint8_t input = 0;
+    // 循环处理8个引脚
     for (uint8_t i = 0; i < 8; i++) {
         uint16_t count = 0;
+        // 读取引脚状态,并进行去抖处理
         for (uint8_t j = 0; j < DEBOUNCE_COUNT; j++) {
-            count += HAL_GPIO_ReadPin(GPIO_PINS[i].port, GPIO_PINS[i].pin) == GPIO_PIN_RESET;
+            count += ReadPinStatus(GPIO_PINS[i].port, GPIO_PINS[i].pin);
         }
-        input |= ((count > DEBOUNCE_COUNT / 2) << i);
+        // 将处理结果存储到input变量中
+		if(count >= 5){
+			input |=  1 << i;
+		}else {
+			input |=  0 << i;
+		}
     }
     return input;
 }

+ 3 - 2
Core/Src/iap.c

@@ -255,10 +255,10 @@ void Process_CMD_IAP_Update(void)
 		FileBuffArray[i] = 0;
 		FileBuffArray1[i] = 0;
 	}
+	YmodemID = USART2_RX_BUF002[4]; 
 	packIndex = (USART2_RX_BUF002[5] << 8) + USART2_RX_BUF002[6];
 	packTotalNum = (USART2_RX_BUF002[7] << 8) + USART2_RX_BUF002[8];
 	lenRx1 = data_lengthU2;
-	YmodemID = USART2_RX_BUF002[4]; 
 	data_lengthU2 = 0;
 	uint8_t ERR_Arr[8] = "error\r\n";
 	uint8_t ACK_Arr[16] = "acknowlege";
@@ -269,7 +269,8 @@ void Process_CMD_IAP_Update(void)
 		if (packIndex == 1)
 		{ //Æğʼ֡´¦Àí
 			FileLength_IAP = (USART2_RX_BUF002[73] << 24) + (USART2_RX_BUF002[74] << 16) + (USART2_RX_BUF002[75] << 8) + (USART2_RX_BUF002[76]);
-			crcIAP = LIB_CRC_MODBUS(&USART2_RX_BUF002[4], 133); //
+			
+			crcIAP = LIB_CRC_MODBUS(&USART2_RX_BUF002[4], 133); 
 			crcTerminal = (USART2_RX_BUF002[lenRx1 - 5] << 8) + USART2_RX_BUF002[lenRx1 - 6];
 			if (crcIAP == crcTerminal)
 			{

+ 0 - 1
Core/Src/main.c

@@ -47,7 +47,6 @@
 /* Private variables ---------------------------------------------------------*/
 
 /* USER CODE BEGIN PV */
-
 int spr000;
 uint8_t  data_to_send[50];
 uint16_t CRC_value 		 = 0;

+ 35 - 0
Core/Src/stm32f1xx_it.c

@@ -59,6 +59,8 @@
 /* USER CODE END 0 */
 
 /* External variables --------------------------------------------------------*/
+extern DMA_HandleTypeDef hdma_adc1;
+extern ADC_HandleTypeDef hadc1;
 extern TIM_HandleTypeDef htim2;
 extern DMA_HandleTypeDef hdma_usart1_rx;
 extern DMA_HandleTypeDef hdma_usart3_rx;
@@ -169,6 +171,20 @@ void DebugMon_Handler(void)
 /* please refer to the startup file (startup_stm32f1xx.s).                    */
 /******************************************************************************/
 
+/**
+  * @brief This function handles DMA1 channel1 global interrupt.
+  */
+void DMA1_Channel1_IRQHandler(void)
+{
+  /* USER CODE BEGIN DMA1_Channel1_IRQn 0 */
+
+  /* USER CODE END DMA1_Channel1_IRQn 0 */
+  HAL_DMA_IRQHandler(&hdma_adc1);
+  /* USER CODE BEGIN DMA1_Channel1_IRQn 1 */
+
+  /* USER CODE END DMA1_Channel1_IRQn 1 */
+}
+
 /**
   * @brief This function handles DMA1 channel3 global interrupt.
   */
@@ -197,6 +213,20 @@ void DMA1_Channel5_IRQHandler(void)
   /* USER CODE END DMA1_Channel5_IRQn 1 */
 }
 
+/**
+  * @brief This function handles ADC1 and ADC2 global interrupts.
+  */
+void ADC1_2_IRQHandler(void)
+{
+  /* USER CODE BEGIN ADC1_2_IRQn 0 */
+
+  /* USER CODE END ADC1_2_IRQn 0 */
+  HAL_ADC_IRQHandler(&hadc1);
+  /* USER CODE BEGIN ADC1_2_IRQn 1 */
+
+  /* USER CODE END ADC1_2_IRQn 1 */
+}
+
 /**
   * @brief This function handles TIM2 global interrupt.
   */
@@ -231,6 +261,8 @@ void TIM3_IRQHandler(void)
 void USART1_IRQHandler(void)
 {
   /* USER CODE BEGIN USART1_IRQn 0 */
+	
+
 	if(RESET != __HAL_UART_GET_FLAG(&huart1, UART_FLAG_IDLE))   //判断是否是空闲中断
 	{
 		__HAL_UART_CLEAR_IDLEFLAG(&huart1);                     //清楚空闲中断标志(否则会一直不断进入中断)
@@ -244,6 +276,9 @@ void USART1_IRQHandler(void)
 		Rx_Flag = 1;
 		flagU2Rx =1;
 	}
+
+
+
   /* USER CODE END USART1_IRQn 0 */
   HAL_UART_IRQHandler(&huart1);
   /* USER CODE BEGIN USART1_IRQn 1 */

+ 0 - 1
Core/Src/usart.c

@@ -365,7 +365,6 @@ uint16_t LIB_CRC_MODBUS(uint8_t* Buf, uint16_t srLen)
         ucHI = ucLO ^ LIB_CRC_MODBUS_HI[srIndex];
         ucLO = LIB_CRC_MODBUS_LO[srIndex];
     }
-
     return ((uint16_t)ucHI<<8) + ucLO;
 }
 /* USER CODE END 1 */

File diff suppressed because it is too large
+ 2049 - 184
MDK-ARM/iocollect.uvguix.Administrator


+ 27 - 44
MDK-ARM/iocollect.uvoptx

@@ -117,6 +117,11 @@
         <pMon>Segger\JL2CM3.dll</pMon>
       </DebugOpt>
       <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DLGUARM</Key>
+          <Name></Name>
+        </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
           <Key>ARMRTXEVENTFLAGS</Key>
@@ -135,7 +140,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>JL2CM3</Key>
-          <Name>-U69618568 -O76 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO31 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103RE$Flash\STM32F10x_512.FLM)</Name>
+          <Name>-U69618568 -O76 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO31 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103RE$Flash\STM32F10x_512.FLM)</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -148,50 +153,22 @@
           <Name>-U-O142 -O2254 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000 -FP0($$Device:STM32F103RE$Flash\STM32F10x_512.FLM)</Name>
         </SetRegEntry>
       </TargetDriverDllRegistry>
-      <Breakpoint>
-        <Bp>
-          <Number>0</Number>
-          <Type>0</Type>
-          <LineNumber>255</LineNumber>
-          <EnabledFlag>1</EnabledFlag>
-          <Address>0</Address>
-          <ByteObject>0</ByteObject>
-          <HtxType>0</HtxType>
-          <ManyObjects>0</ManyObjects>
-          <SizeOfObject>0</SizeOfObject>
-          <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>0</BreakIfRCount>
-          <Filename>../Core/Src/freertos.c</Filename>
-          <ExecCommand></ExecCommand>
-          <Expression></Expression>
-        </Bp>
-        <Bp>
-          <Number>1</Number>
-          <Type>0</Type>
-          <LineNumber>255</LineNumber>
-          <EnabledFlag>1</EnabledFlag>
-          <Address>134242932</Address>
-          <ByteObject>0</ByteObject>
-          <HtxType>0</HtxType>
-          <ManyObjects>0</ManyObjects>
-          <SizeOfObject>0</SizeOfObject>
-          <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>1</BreakIfRCount>
-          <Filename>E:\Developing\浠撳簱搴曟湰_鎻愪氦闇€瑕嗙洊(闄?git)\Core\Src\freertos.c</Filename>
-          <ExecCommand></ExecCommand>
-          <Expression>\\iocollect_230608\../Core/Src/freertos.c\255</Expression>
-        </Bp>
-      </Breakpoint>
+      <Breakpoint/>
       <WatchWindow1>
         <Ww>
           <count>0</count>
           <WinNumber>1</WinNumber>
-          <ItemText>USART2_RX_BUF003[i000]</ItemText>
+          <ItemText>input</ItemText>
         </Ww>
         <Ww>
           <count>1</count>
           <WinNumber>1</WinNumber>
-          <ItemText>USART2_RX_BUF003</ItemText>
+          <ItemText>count</ItemText>
+        </Ww>
+        <Ww>
+          <count>2</count>
+          <WinNumber>1</WinNumber>
+          <ItemText>count</ItemText>
         </Ww>
       </WatchWindow1>
       <WatchWindow2>
@@ -239,7 +216,7 @@
       <DebugFlag>
         <trace>0</trace>
         <periodic>1</periodic>
-        <aLwin>0</aLwin>
+        <aLwin>1</aLwin>
         <aCover>0</aCover>
         <aSer1>0</aSer1>
         <aSer2>0</aSer2>
@@ -275,6 +252,12 @@
       <pszMrulep></pszMrulep>
       <pSingCmdsp></pSingCmdsp>
       <pMultCmdsp></pMultCmdsp>
+      <SystemViewers>
+        <Entry>
+          <Name>System Viewer\GPIOA</Name>
+          <WinId>35905</WinId>
+        </Entry>
+      </SystemViewers>
       <DebugDescription>
         <Enable>1</Enable>
         <EnableFlashSeq>1</EnableFlashSeq>
@@ -366,8 +349,8 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/main.c</PathWithFileName>
-      <FilenameWithoutPath>main.c</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/freertos.c</PathWithFileName>
+      <FilenameWithoutPath>freertos.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -378,8 +361,8 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/gpio.c</PathWithFileName>
-      <FilenameWithoutPath>gpio.c</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/main.c</PathWithFileName>
+      <FilenameWithoutPath>main.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
@@ -390,8 +373,8 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>../Core/Src/freertos.c</PathWithFileName>
-      <FilenameWithoutPath>freertos.c</FilenameWithoutPath>
+      <PathWithFileName>../Core/Src/gpio.c</PathWithFileName>
+      <FilenameWithoutPath>gpio.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>

+ 12 - 12
MDK-ARM/iocollect.uvprojx

@@ -49,7 +49,7 @@
             <InvalidFlash>1</InvalidFlash>
           </TargetStatus>
           <OutputDirectory>..\Output\</OutputDirectory>
-          <OutputName>iocollect_230608</OutputName>
+          <OutputName>iocollect_230625</OutputName>
           <CreateExecutable>1</CreateExecutable>
           <CreateLib>0</CreateLib>
           <CreateHexFile>1</CreateHexFile>
@@ -82,7 +82,7 @@
           <AfterMake>
             <RunUserProg1>1</RunUserProg1>
             <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name>fromelf.exe --bin --output ..\Output\iocollect_230608.bin ..\Output\*.axf</UserProg1Name>
+            <UserProg1Name>fromelf.exe --bin --output ..\Output\iocollect_230625.bin ..\Output\*.axf</UserProg1Name>
             <UserProg2Name></UserProg2Name>
             <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
             <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
@@ -414,16 +414,6 @@
               <FileType>1</FileType>
               <FilePath>..\Core\Src\Data_deal.c</FilePath>
             </File>
-            <File>
-              <FileName>main.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../Core/Src/main.c</FilePath>
-            </File>
-            <File>
-              <FileName>gpio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../Core/Src/gpio.c</FilePath>
-            </File>
             <File>
               <FileName>freertos.c</FileName>
               <FileType>1</FileType>
@@ -480,6 +470,16 @@
                 </FileArmAds>
               </FileOption>
             </File>
+            <File>
+              <FileName>main.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../Core/Src/main.c</FilePath>
+            </File>
+            <File>
+              <FileName>gpio.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../Core/Src/gpio.c</FilePath>
+            </File>
             <File>
               <FileName>adc.c</FileName>
               <FileType>1</FileType>

+ 13 - 1
iocollect.ioc

@@ -17,9 +17,19 @@ ADC1.master=1
 CAD.formats=
 CAD.pinconfig=
 CAD.provider=
+Dma.ADC1.2.Direction=DMA_PERIPH_TO_MEMORY
+Dma.ADC1.2.Instance=DMA1_Channel1
+Dma.ADC1.2.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
+Dma.ADC1.2.MemInc=DMA_MINC_ENABLE
+Dma.ADC1.2.Mode=DMA_CIRCULAR
+Dma.ADC1.2.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
+Dma.ADC1.2.PeriphInc=DMA_PINC_DISABLE
+Dma.ADC1.2.Priority=DMA_PRIORITY_LOW
+Dma.ADC1.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
 Dma.Request0=USART1_RX
 Dma.Request1=USART3_RX
-Dma.RequestsNb=2
+Dma.Request2=ADC1
+Dma.RequestsNb=3
 Dma.USART1_RX.0.Direction=DMA_PERIPH_TO_MEMORY
 Dma.USART1_RX.0.Instance=DMA1_Channel5
 Dma.USART1_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
@@ -92,7 +102,9 @@ Mcu.UserConstants=
 Mcu.UserName=STM32F103RETx
 MxCube.Version=6.8.1
 MxDb.Version=DB.6.0.81
+NVIC.ADC1_2_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
+NVIC.DMA1_Channel1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
 NVIC.DMA1_Channel3_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
 NVIC.DMA1_Channel5_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
 NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false

+ 8 - 2
readme.md

@@ -25,7 +25,13 @@
 ### function_v1.2: 
 **Add Function**
 > ######<u>Updated on 6/7/2023 2:10:31 PM   </u>
-> #####Add IAP(In Application Programming); (tips:更新文件要更换IR_ROM1地址(包括魔术棒和main.h),在output中要更新版本号)
-**hyperlink**:**[ASCII码转换网址](https://www.qqxiuzi.cn/bianma/ascii.htm "ASCII码转换网址")**(tips:1个ASCII码(2个数字)后要加一个英文逗号方可进行解析)
+> #####Add IAP_V1.0(In Application Programming);
 
+---
+### function_v2.0:
+> ######<u>Updated on 6/20/2023 1:48:34 PM    </u>
+> #####Add freertos embedded system;
 
+**Repair function**
+> #####<u>Updated on 6/25/2023 2:49:47 PM    </u>
+> #####Repair temperature measurement function;