功能基本OK,485还需完善

This commit is contained in:
95384 2025-08-06 12:59:57 +08:00
parent decc3ad725
commit a2c0228d29
19 changed files with 640 additions and 84 deletions

File diff suppressed because one or more lines are too long

26
APP/inc/adc2temp.h Normal file
View File

@ -0,0 +1,26 @@
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ADC_2_TEMP_H__
#define __ADC_2_TEMP_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
extern uint16_t adc_value_of_temp;
extern float g_temp_value;
void adc_2_temp(void);
#ifdef __cplusplus
}
#endif
#endif /* __ADC_2_TEMP_H__ */

View File

@ -10,8 +10,9 @@ extern "C" {
/* Includes ------------------------------------------------------------------*/
#include "main.h"
void start_heat(void);
//void start_heat(void);
void stop_heat(void);
void temp_ctrl(void);
#ifdef __cplusplus
}

76
APP/src/adc2temp.c Normal file
View File

@ -0,0 +1,76 @@
#include "adc2temp.h"
#include <stdint.h>
//unit:10Ω
uint16_t r_table[] =
{
9533, 9265, 9005, 8754, 8510, 8273, 8044, 7822, 7606, 7398,
7195, 6999, 6808, 6624, 6444, 6271, 6102, 5939, 5780, 5626,
5476, 5331, 5191, 5054, 4921, 4792, 4667, 4546, 4428, 4314,
4202, 4094, 3989, 3887, 3788, 3692, 3598, 3508, 3419, 3333,
3250, 3169, 3090, 3013, 2938, 2866, 2795, 2727, 2660, 2595,
2532, 2471, 2411, 2353, 2296, 2241, 2187, 2135, 2085, 2035,
1987, 1940, 1895, 1850, 1807, 1765, 1724, 1684, 1645, 1607,
1570, 1534, 1499, 1465, 1431, 1399, 1367, 1337, 1307, 1221,
1194, 1167, 1141, 1116, 1092, 1068, 1044, 1022, 1000, 978,
957, 936, 916, 896, 877, 858, 840, 822, 805, 788,
771, 755, 739, 724, 709, 694, 680, 666, 652, 639,
626, 613, 600, 588, 576, 565, 553, 542, 531, 521,
510, 500, 490, 480, 471, 462, 453, 444, 435, 427,
418, 410, 402, 395, 387, 380, 372, 365, 358, 351,
345, 338, 332, 326, 320, 314, 308, 302, 296, 291,
286, 280, 275, 270, 265, 260, 256, 251, 238, 233,
229, 225, 221, 217, 213, 210, 206, 202, 199, 195,
192, 189, 185, 182, 179, 176, 173, 170, 167, 164,
161, 159, 156, 153, 151, 148, 146, 143, 141, 139,
136, 134, 132, 130, 127, 125, 123, 121, 119, 117,
115, 114, 112, 110, 108, 107, 105, 103, 101, 100,
98, 97, 95, 94, 92, 91, 89, 88, 87, 85,
84, 83, 81, 80, 79, 78, 77, 75, 74, 73,
72, 71, 70, 69, 68, 67, 66
};
uint16_t adc_value_of_temp = 0;
float g_temp_value;
void adc_2_temp(void)
{
float r_of_temp_10 = 100.0 * (float)(adc_value_of_temp) * 10.0f / (4095.0f - (float)(adc_value_of_temp));
int i = 0;
const int array_size = 237; // 实际数组大小
const int last_index = array_size - 1; // 最后一个索引236
// 处理超出上限的电阻值(大于最大电阻值)
if (r_of_temp_10 >= r_table[0]) {
i = 0; // 使用第一个区间进行外推
}
// 处理低于下限的电阻值(小于最小电阻值)
else if (r_of_temp_10 <= r_table[last_index]) {
i = last_index - 1; // 使用最后一个区间进行外推索引236-237
}
// 在有效范围内查找区间
else {
// 遍历237个区间索引0-236对应区间0-1,1-2,...,236-237
for (; i < last_index; i++) {
// 检查电阻值是否在当前区间 [r_temp[i], r_temp[i+1]) 内
if (r_of_temp_10 <= r_table[i] && r_of_temp_10 > r_table[i+1]) {
break;
}
}
}
// 获取当前区间的电阻边界值
float R_high = r_table[i]; // 较高电阻值(对应较低温度)
float R_low = r_table[i+1]; // 较低电阻值(对应较高温度)
// 获取当前区间的温度边界值
float T_high = -20.0f + 0.5f * i; // 较低温度
float T_low = -20.0f + 0.5f * (i+1); // 较高温度
// 线性插值计算温度
// 公式T = T_high + (R_high - resistance) * (T_low - T_high) / (R_high - R_low)
g_temp_value = T_high + (R_high - r_of_temp_10) * (T_low - T_high) / (R_high - R_low);
// g_temp_value = -30.5;
}

View File

@ -1,6 +1,7 @@
#include "heat.h"
#include "adc2temp.h"
void start_heat(void)
static void start_heat(void)
{
HEAT_PORT_GPIO_Port -> BRR = (uint32_t)HEAT_PORT_Pin;
}
@ -9,3 +10,15 @@ void stop_heat(void)
{
HEAT_PORT_GPIO_Port -> BSRR = (uint32_t)HEAT_PORT_Pin;
}
void temp_ctrl(void)
{
if (g_temp_value < -30)
{
start_heat();
}
else if (g_temp_value > -20)
{
stop_heat();
}
}

View File

@ -2,13 +2,12 @@
#include "string.h"
#include "receive_data.h"
#include "usart.h"
#include "adc2temp.h"
#define CLIMATE_BUFF_CRC16(x) ((x[8 - 2]) | (x[8 - 1] << 8))
uint8_t rs485_pack_buff[30] = {0};
uint16_t tmp_tmp = 60000;
static uint8_t uart_read_climate_pack(uart_device_info *device, uint8_t buffsize)
{
uint8_t offset = 0;
@ -67,8 +66,8 @@ uint8_t MsgHandler(uart_device_info *device)
else if(rs485_pack_buff[2] == 0x00 && rs485_pack_buff[3] == 0x00 &&rs485_pack_buff[4] == 0x00 &&rs485_pack_buff[5] == 0x01)
{
uint8_t ret_buf[] = {0x30, 0x03, 0x02, 0x00, 0x00, 0x45, 0x45};
ret_buf[3] = (tmp_tmp >> 8)&0x00FF;
ret_buf[4] = tmp_tmp & 0x00FF;
ret_buf[3] = ((uint16_t)(g_temp_value * 10) >> 8)&0x00FF;
ret_buf[4] = (uint16_t)(g_temp_value * 10) & 0x00FF;
uint16_t ret_crc = CRC16(ret_buf, 5);
ret_buf[5] = ret_crc & 0x00FF;
ret_buf[6] = (ret_crc >> 8)&0x00FF;

52
Core/Inc/adc.h Normal file
View File

@ -0,0 +1,52 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file adc.h
* @brief This file contains all the function prototypes for
* the adc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ADC_H__
#define __ADC_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern ADC_HandleTypeDef hadc2;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_ADC2_Init(void);
/* USER CODE BEGIN Prototypes */
uint16_t get_adc_value(void);
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __ADC_H__ */

View File

@ -36,7 +36,7 @@
#define HAL_MODULE_ENABLED
/*#define HAL_ADC_MODULE_ENABLED */
#define HAL_ADC_MODULE_ENABLED
/*#define HAL_COMP_MODULE_ENABLED */
/*#define HAL_CORDIC_MODULE_ENABLED */
/*#define HAL_CRC_MODULE_ENABLED */

151
Core/Src/adc.c Normal file
View File

@ -0,0 +1,151 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file adc.c
* @brief This file provides code for the configuration
* of the ADC instances.
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "adc.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
ADC_HandleTypeDef hadc2;
/* ADC2 init function */
void MX_ADC2_Init(void)
{
/* USER CODE BEGIN ADC2_Init 0 */
/* USER CODE END ADC2_Init 0 */
ADC_ChannelConfTypeDef sConfig = {0};
/* USER CODE BEGIN ADC2_Init 1 */
/* USER CODE END ADC2_Init 1 */
/** Common config
*/
hadc2.Instance = ADC2;
hadc2.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
hadc2.Init.Resolution = ADC_RESOLUTION_12B;
hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc2.Init.GainCompensation = 0;
hadc2.Init.ScanConvMode = ADC_SCAN_DISABLE;
hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
hadc2.Init.LowPowerAutoWait = DISABLE;
hadc2.Init.ContinuousConvMode = DISABLE;
hadc2.Init.NbrOfConversion = 1;
hadc2.Init.DiscontinuousConvMode = DISABLE;
hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc2.Init.DMAContinuousRequests = DISABLE;
hadc2.Init.Overrun = ADC_OVR_DATA_PRESERVED;
hadc2.Init.OversamplingMode = DISABLE;
if (HAL_ADC_Init(&hadc2) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_15;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_640CYCLES_5;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN ADC2_Init 2 */
/* USER CODE END ADC2_Init 2 */
}
void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(adcHandle->Instance==ADC2)
{
/* USER CODE BEGIN ADC2_MspInit 0 */
/* USER CODE END ADC2_MspInit 0 */
/** Initializes the peripherals clocks
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC12;
PeriphClkInit.Adc12ClockSelection = RCC_ADC12CLKSOURCE_SYSCLK;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
/* ADC2 clock enable */
__HAL_RCC_ADC12_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/**ADC2 GPIO Configuration
PB15 ------> ADC2_IN15
*/
GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* USER CODE BEGIN ADC2_MspInit 1 */
/* USER CODE END ADC2_MspInit 1 */
}
}
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
{
if(adcHandle->Instance==ADC2)
{
/* USER CODE BEGIN ADC2_MspDeInit 0 */
/* USER CODE END ADC2_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_ADC12_CLK_DISABLE();
/**ADC2 GPIO Configuration
PB15 ------> ADC2_IN15
*/
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_15);
/* USER CODE BEGIN ADC2_MspDeInit 1 */
/* USER CODE END ADC2_MspDeInit 1 */
}
}
/* USER CODE BEGIN 1 */
uint16_t get_adc_value(void)
{
HAL_ADC_Start(&hadc2);
HAL_ADC_PollForConversion(&hadc2, 200);
return HAL_ADC_GetValue(&hadc2);
}
/* USER CODE END 1 */

View File

@ -18,6 +18,7 @@
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "adc.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
@ -28,6 +29,7 @@
#include "ring_queue.h"
#include "receive_data.h"
#include "protocol.h"
#include "adc2temp.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -93,6 +95,7 @@ int main(void)
MX_GPIO_Init();
MX_TIM7_Init();
MX_USART3_UART_Init();
MX_ADC2_Init();
/* USER CODE BEGIN 2 */
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD>رռ<D8B1><D5BC><EFBFBD>
stop_heat();
@ -101,6 +104,7 @@ int main(void)
HAL_TIM_Base_Start_IT(&htim7);
HAL_UART_Receive_IT(&huart3, rx_uart3_buf, 1);
HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);
/* USER CODE END 2 */
/* Infinite loop */
@ -129,7 +133,10 @@ int main(void)
if(g_tim7_1000ms_flag)
{
g_tim7_1000ms_flag = 0;
temp_ctrl();
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
adc_value_of_temp = get_adc_value();
adc_2_temp();
}
/* USER CODE END WHILE */

88
DOC/temp_table.h Normal file
View File

@ -0,0 +1,88 @@
#ifndef TEMP_TABLE_H
#define TEMP_TABLE_H
#include <stdint.h>
/**
* @file temp_table.h
* @brief NTC热敏电阻温度- (:10Ω)
*
* .txt
* 238
*
*/
const uint16_t r_temp[] = {
9533, 9265, 9005, 8754, 8510, 8273, 8044, 7822, 7606, 7398,
7195, 6999, 6808, 6624, 6444, 6271, 6102, 5939, 5780, 5626,
5476, 5331, 5191, 5054, 4921, 4792, 4667, 4546, 4428, 4314,
4202, 4094, 3989, 3887, 3788, 3692, 3598, 3508, 3419, 3333,
3250, 3169, 3090, 3013, 2938, 2866, 2795, 2727, 2660, 2595,
2532, 2471, 2411, 2353, 2296, 2241, 2187, 2135, 2085, 2035,
1987, 1940, 1895, 1850, 1807, 1765, 1724, 1684, 1645, 1607,
1570, 1534, 1499, 1465, 1431, 1399, 1367, 1337, 1307, 1221,
1194, 1167, 1141, 1116, 1092, 1068, 1044, 1022, 1000, 978,
957, 936, 916, 896, 877, 858, 840, 822, 805, 788,
771, 755, 739, 724, 709, 694, 680, 666, 652, 639,
626, 613, 600, 588, 576, 565, 553, 542, 531, 521,
510, 500, 490, 480, 471, 462, 453, 444, 435, 427,
418, 410, 402, 395, 387, 380, 372, 365, 358, 351,
345, 338, 332, 326, 320, 314, 308, 302, 296, 291,
286, 280, 275, 270, 265, 260, 256, 251, 238, 233,
229, 225, 221, 217, 213, 210, 206, 202, 199, 195,
192, 189, 185, 182, 179, 176, 173, 170, 167, 164,
161, 159, 156, 153, 151, 148, 146, 143, 141, 139,
136, 134, 132, 130, 127, 125, 123, 121, 119, 117,
115, 114, 112, 110, 108, 107, 105, 103, 101, 100,
98, 97, 95, 94, 92, 91, 89, 88, 87, 85,
84, 83, 81, 80, 79, 78, 77, 75, 74, 73,
72, 71, 70, 69, 68, 67, 66
};
/**
* @brief 线
* @param resistance 10Ω
* @return
*
* 2380-237
* 0.5°C温度步进
* -20.0°C 98.5°C
*/
static inline float get_temp_from_resistance(uint16_t resistance) {
int i = 0;
const int array_size = 238; // 实际数组大小
const int last_index = array_size - 1; // 最后一个索引237
// 处理超出上限的电阻值(大于最大电阻值)
if (resistance >= r_temp[0]) {
i = 0; // 使用第一个区间进行外推
}
// 处理低于下限的电阻值(小于最小电阻值)
else if (resistance <= r_temp[last_index]) {
i = last_index - 1; // 使用最后一个区间进行外推索引236-237
}
// 在有效范围内查找区间
else {
// 遍历237个区间索引0-236对应区间0-1,1-2,...,236-237
for (; i < last_index; i++) {
// 检查电阻值是否在当前区间 [r_temp[i], r_temp[i+1]) 内
if (resistance <= r_temp[i] && resistance > r_temp[i+1]) {
break;
}
}
}
// 获取当前区间的电阻边界值
float R_high = r_temp[i]; // 较高电阻值(对应较低温度)
float R_low = r_temp[i+1]; // 较低电阻值(对应较高温度)
// 获取当前区间的温度边界值
float T_high = -20.0f + 0.5f * i; // 较低温度
float T_low = -20.0f + 0.5f * (i+1); // 较高温度
// 最高温度:-20 + 0.5 * 237 = 98.5°C
// 线性插值计算温度
// 公式T = T_high + (R_high - resistance) * (T_low - T_high) / (R_high - R_low)
return T_high + (R_high - resistance) * (T_low - T_high) / (R_high - R_low);
}
#endif // TEMP_TABLE_H

82
DOC/温度对照表.txt Normal file
View File

@ -0,0 +1,82 @@
T(℃)    R(KΩ)        T(℃)   R(KΩ)       T(℃)    R(KΩ)
-20.0   95.3370        20.5   12.2138        61.0    2.3820  
-19.5   92.6559        21.0   11.9425        61.5    2.3394  
-19.0   90.0580        21.5   11.6778        62.0    2.2977  
-18.5   87.5406        22.0   11.4198        62.5    2.2568  
-18.0   85.1009        22.5   11.1681        63.0    2.2167  
-17.5   82.7364        23.0   10.9227        63.5    2.1775   
-17.0   80.4445        23.5   10.6834        64.0    2.1390  
-16.5   78.2227        24.0   10.4499        64.5    2.1013  
-16.0   76.0689        24.5   10.2222        65.0    2.0644  
-15.5   73.9806        25.0   10.0000        65.5    2.0282  
-15.0   71.9558        25.5    9.7833        66.0    1.9928  
-14.5   69.9923        26.0    9.5718        66.5    1.9580  
-14.0   68.0881        26.5    9.3655        67.0    1.9240  
-13.5   66.2412        27.0    9.1642        67.5    1.8906  
-13.0   64.4499        27.5    8.9677        68.0    1.8579  
-12.5   62.7122        28.0    8.7760        68.5    1.8258  
-12.0   61.0264        28.5    8.5889        69.0    1.7944  
-11.5   59.3908        29.0    8.4063        69.5    1.7636  
-11.0   57.8038        29.5    8.2281        70.0    1.7334  
-10.5   56.2639        30.0    8.0541        70.5    1.7037  
-10.0   54.7694        30.5    7.8842        71.0    1.6747  
-9.5   53.3189        31.0    7.7184        71.5    1.6462  
-9.0   51.9111        31.5    7.5565        72.0    1.6183  
-8.5   50.5445        32.0    7.3985        72.5    1.5910  
-8.0   49.2178        32.5    7.2442        73.0    1.5641  
-7.5   47.9298        33.0    7.0935        73.5    1.5378  
-7.0   46.6792        33.5    6.9463        74.0    1.5120  
-6.5   45.4649        34.0    6.8026        74.5    1.4867  
-6.0   44.2856        34.5    6.6622        75.0    1.4619  
-5.5   43.1403        35.0    6.5251        75.5    1.4375  
-5.0   42.0279        35.5    6.3912        76.0    1.4136  
-4.5   40.9474        36.0    6.2604        76.5    1.3902  
-4.0   39.8978        36.5    6.1326        77.0    1.3672  
-3.5   38.8780        37.0    6.0077        77.5    1.3447  
-3.0   37.8873        37.5    5.8858        78.0    1.3225  
-2.5   36.9246        38.0    5.7666        78.5    1.3008  
-2.0   35.9892        38.5    5.6501        79.0    1.2795  
-1.5   35.0801        39.0    5.5363        79.5    1.2586  
-1.0   34.1965        39.5    5.4251        80.0    1.2381  
-0.5   33.3378        40.0    5.3164        80.5    1.2180  
0.0   32.5030        40.5    5.2102        81.0    1.1983  
0.5   31.6915        41.0    5.1064        81.5    1.1789  
1.0   30.9026        41.5    5.0049        82.0    1.1599  
1.5   30.1355        42.0    4.9057        82.5    1.1412  
2.0   29.3896        42.5    4.8088        83.0    1.1229  
2.5   28.6644        43.0    4.7140        83.5    1.1050  
3.0   27.9590        43.5    4.6213        84.0    1.0873  
3.5   27.2730        44.0    4.5307        84.5    1.0700  
4.0   26.6058        44.5    4.4421        85.0    1.0530  
4.5   25.9567        45.0    4.3554        85.5    1.0363  
5.0   25.3254        45.5    4.2707        86.0    1.0199  
5.5   24.7111        46.0    4.1878        86.5    1.0038  
6.0   24.1135        46.5    4.1068        87.0    0.9880  
6.5   23.5320        47.0    4.0275        87.5    0.9725  
7.0   22.9661        47.5    3.9500        88.0    0.9573  
7.5   22.4154        48.0    3.8742        88.5    0.9424  
8.0   21.8795        48.5    3.8000        89.0    0.9277  
8.5   21.3579        49.0    3.7275        89.5    0.9133  
9.0   20.8502        49.5    3.6565        90.0    0.8991  
9.5   20.3559        50.0    3.5870        90.5    0.8852  
10.0   19.8747        50.5    3.5190        91.0    0.8715  
10.5   19.4063        51.0    3.4525        91.5    0.8581  
11.0   18.9502        51.5    3.3875        92.0    0.8450  
11.5   18.5060        52.0    3.3238        92.5    0.8320  
12.0   18.0735        52.5    3.2615        93.0    0.8193  
12.5   17.6523        53.0    3.2005        93.5    0.8068  
13.0   17.2421        53.5    3.1408        94.0    0.7945  
13.5   16.8426        54.0    3.0824        94.5    0.7825  
14.0   16.4534        54.5    3.0252        95.0    0.7707  
14.5   16.0743        55.0    2.9692        95.5    0.7590  
15.0   15.7049        55.5    2.9144        96.0    0.7476  
15.5   15.3450        56.0    2.8608        96.5    0.7364  
16.0   14.9944        56.5    2.8082        97.0    0.7253  
16.5   14.6528        57.0    2.7568        97.5    0.7145  
17.0   14.3198        57.5    2.7065        98.0    0.7038  
17.5   13.9954        58.0    2.6572        98.5    0.6933  
18.0   13.6792        58.5    2.6089        99.0    0.6831  
18.5   13.3710        59.0    2.5616        99.5    0.6729  
19.0   13.0705        59.5    2.5153       100.0    0.6630  
19.5   12.7777        60.0    2.4700       R25=10KΩ
20.0   12.4922        60.5    2.4255       B25/50=3950K+1%

File diff suppressed because one or more lines are too long

View File

@ -1098,6 +1098,9 @@
</configuration>
<group>
<name>APP</name>
<file>
<name>$PROJ_DIR$\..\APP\src\adc2temp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\APP\src\heat.c</name>
</file>
@ -1123,6 +1126,9 @@
<name>User</name>
<group>
<name>Core</name>
<file>
<name>$PROJ_DIR$\..\Core\Src\adc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Core\Src\gpio.c</name>
</file>
@ -1157,6 +1163,12 @@
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c</name>
</file>
@ -1205,6 +1217,9 @@
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c</name>
</file>
</group>
</group>
</project>

View File

@ -1428,6 +1428,9 @@
</configuration>
<group>
<name>APP</name>
<file>
<name>$PROJ_DIR$\..\APP\src\adc2temp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\APP\src\heat.c</name>
</file>
@ -1453,6 +1456,9 @@
<name>User</name>
<group>
<name>Core</name>
<file>
<name>$PROJ_DIR$\..\Core\Src\adc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Core\Src\gpio.c</name>
</file>
@ -1487,6 +1493,12 @@
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c</name>
</file>
@ -1535,6 +1547,9 @@
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c</name>
</file>
</group>
</group>
</project>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,17 +3,17 @@
<StLinkDriver>
<stlinkserialNo>0669FF3434584D3043103844</stlinkserialNo>
<stlinkfoundProbes />
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<CStepIntDis>_ 0</CStepIntDis>
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<CStepIntDis>_ 0</CStepIntDis>
</StLinkDriver>
<PlDriver>
<FirstRun>0</FirstRun>
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32G431RB.ddf</MemConfigValue>
</PlDriver>
<DebugChecksum>
<Checksum>4077576522</Checksum>
<Checksum>3493153764</Checksum>
</DebugChecksum>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>
@ -117,20 +117,6 @@
<ShowTimeSum>1</ShowTimeSum>
<SumSortOrder>0</SumSortOrder>
</EventLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
<DriverProfiling>
<Enabled>0</Enabled>
<Mode>3</Mode>
@ -138,4 +124,18 @@
<Symbiont>0</Symbiont>
<Exclusions />
</DriverProfiling>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
</settings>

View File

@ -1,4 +1,11 @@
#MicroXplorer Configuration settings - do not modify
ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_15
ADC2.CommonPathInternal=null|null|null|null
ADC2.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,NbrOfConversionFlag,CommonPathInternal
ADC2.NbrOfConversionFlag=1
ADC2.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
ADC2.Rank-0\#ChannelRegularConversion=1
ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_640CYCLES_5
CAD.formats=
CAD.pinconfig=
CAD.provider=
@ -7,27 +14,29 @@ GPIO.groupedBy=
KeepUserPlacement=false
Mcu.CPN=STM32G431RBT6
Mcu.Family=STM32G4
Mcu.IP0=NVIC
Mcu.IP1=RCC
Mcu.IP2=SYS
Mcu.IP3=TIM7
Mcu.IP4=USART3
Mcu.IPNb=5
Mcu.IP0=ADC2
Mcu.IP1=NVIC
Mcu.IP2=RCC
Mcu.IP3=SYS
Mcu.IP4=TIM7
Mcu.IP5=USART3
Mcu.IPNb=6
Mcu.Name=STM32G431R(6-8-B)Tx
Mcu.Package=LQFP64
Mcu.Pin0=PF0-OSC_IN
Mcu.Pin1=PF1-OSC_OUT
Mcu.Pin10=VP_SYS_VS_DBSignals
Mcu.Pin11=VP_TIM7_VS_ClockSourceINT
Mcu.Pin10=VP_SYS_VS_Systick
Mcu.Pin11=VP_SYS_VS_DBSignals
Mcu.Pin12=VP_TIM7_VS_ClockSourceINT
Mcu.Pin2=PB10
Mcu.Pin3=PB11
Mcu.Pin4=PB14
Mcu.Pin5=PC9
Mcu.Pin6=PA13
Mcu.Pin7=PA14
Mcu.Pin8=PB6
Mcu.Pin9=VP_SYS_VS_Systick
Mcu.PinsNb=12
Mcu.Pin5=PB15
Mcu.Pin6=PC9
Mcu.Pin7=PA13
Mcu.Pin8=PA14
Mcu.Pin9=PB6
Mcu.PinsNb=13
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32G431RBTx
@ -56,6 +65,8 @@ PB11.Mode=Asynchronous
PB11.Signal=USART3_RX
PB14.Mode=Hardware Flow Control (RS485)
PB14.Signal=USART3_DE
PB15.Mode=IN15-Single-Ended
PB15.Signal=ADC2_IN15
PB6.GPIOParameters=GPIO_Label
PB6.GPIO_Label=LED
PB6.Locked=true
@ -99,7 +110,7 @@ ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM7_Init-TIM7-false-HAL-true
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM7_Init-TIM7-false-HAL-true,4-MX_USART3_UART_Init-USART3-false-HAL-true
RCC.ADC12Freq_Value=100000000
RCC.AHBFreq_Value=100000000
RCC.APB1Freq_Value=100000000