存档:热电偶查表数据写入
This commit is contained in:
parent
d13a90f853
commit
ffd10e8ccf
|
@ -2,7 +2,7 @@
|
||||||
* @Author: wujunchao wujunchao@wuxismart.com
|
* @Author: wujunchao wujunchao@wuxismart.com
|
||||||
* @Date: 2024-12-27 11:51:06
|
* @Date: 2024-12-27 11:51:06
|
||||||
* @LastEditors: wujunchao wujunchao@wuxismart.com
|
* @LastEditors: wujunchao wujunchao@wuxismart.com
|
||||||
* @LastEditTime: 2025-03-20 09:35:49
|
* @LastEditTime: 2025-03-20 09:53:31
|
||||||
* @FilePath: \signal_generator\App\APP_WU\Inc\apps_gather.h
|
* @FilePath: \signal_generator\App\APP_WU\Inc\apps_gather.h
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
*/
|
*/
|
||||||
|
@ -211,6 +211,7 @@ extern PHYSICAL_QUANTITY FRE; //频率,KHz
|
||||||
extern PHYSICAL_QUANTITY TC[8]; //热电偶,共8种
|
extern PHYSICAL_QUANTITY TC[8]; //热电偶,共8种
|
||||||
extern PHYSICAL_QUANTITY RTD; //热电阻
|
extern PHYSICAL_QUANTITY RTD; //热电阻
|
||||||
|
|
||||||
|
|
||||||
//按键值
|
//按键值
|
||||||
#define KEY_OUT 76
|
#define KEY_OUT 76
|
||||||
#define KEY_UP 84
|
#define KEY_UP 84
|
||||||
|
@ -236,6 +237,9 @@ float32 my_power(int a, int b);
|
||||||
//物理量内容初始化
|
//物理量内容初始化
|
||||||
void physical_quantity_init(void);
|
void physical_quantity_init(void);
|
||||||
|
|
||||||
|
//热电偶数据初始化
|
||||||
|
void TC_init(void);
|
||||||
|
|
||||||
//通道选择与切换
|
//通道选择与切换
|
||||||
void sig_channel_select(uint8_t io, SIG_FUNCTIONS_TYPE type);
|
void sig_channel_select(uint8_t io, SIG_FUNCTIONS_TYPE type);
|
||||||
|
|
||||||
|
|
|
@ -466,11 +466,11 @@ void key_functions_main(void)
|
||||||
|
|
||||||
case SIG_TC: //热电偶
|
case SIG_TC: //热电偶
|
||||||
{
|
{
|
||||||
cursor_temp = (uint8_t)m5data.output_mode_type;
|
cursor_temp = (uint8_t)m5data.input_mode_type;
|
||||||
cursor_temp = (cursor_temp >= 7)?(5):(cursor_temp + 1);
|
cursor_temp = (cursor_temp >= 12)?(5):(cursor_temp + 1);
|
||||||
m5data.output_mode_type = (SIG_FUNCTIONS_TYPE)cursor_temp;
|
m5data.input_mode_type = (SIG_FUNCTIONS_TYPE)cursor_temp;
|
||||||
|
|
||||||
set_working_mode(m5data.output_mode, m5data.output_mode_type);
|
set_working_mode(m5data.input_mode, m5data.input_mode_type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author: wujunchao wujunchao@wuxismart.com
|
* @Author: wujunchao wujunchao@wuxismart.com
|
||||||
* @Date: 2024-12-27 11:50:56
|
* @Date: 2024-12-27 11:50:56
|
||||||
* @LastEditors: wujunchao wujunchao@wuxismart.com
|
* @LastEditors: wujunchao wujunchao@wuxismart.com
|
||||||
* @LastEditTime: 2025-03-20 09:47:34
|
* @LastEditTime: 2025-03-20 12:28:06
|
||||||
* @FilePath: \signal_generator\App\APP_WU\Src\apps_gather.c
|
* @FilePath: \signal_generator\App\APP_WU\Src\apps_gather.c
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,94 @@ PHYSICAL_QUANTITY FRE; //频率,KHz
|
||||||
PHYSICAL_QUANTITY TC[8]; //热电偶,共8种
|
PHYSICAL_QUANTITY TC[8]; //热电偶,共8种
|
||||||
PHYSICAL_QUANTITY RTD; //热电阻
|
PHYSICAL_QUANTITY RTD; //热电阻
|
||||||
|
|
||||||
|
// 热电偶真值表,电压mV
|
||||||
|
// 行:[0,7]->[K, S, N, B, E, J, R, T],列:[0,10]->[mV_Tmin,...,mV_Tmax](均分成10个间隔,11个端点)
|
||||||
|
static float32 TC_TABLE_MV[8][11] =
|
||||||
|
{
|
||||||
|
{-6.458, -3.734, 2.354, 9.061, 15.849, 22.819, 29.757, 36.484, 42.980, 49.130, 54.886},
|
||||||
|
{-0.236, 0.888, 2.451, 4.184, 6.034, 7.992, 10.063, 12.228, 14.421, 16.611, 18.693},
|
||||||
|
{-4.345, -2.672, 1.174, 5.946, 11.428, 17.323, 23.428, 29.592, 35.714, 41.713, 47.513},
|
||||||
|
{0.000, 0.144, 0.647, 1.483, 2.625, 4.041, 5.702, 7.567, 9.593, 11.708, 13.820},
|
||||||
|
{-9.835, -7.021, -0.925, 7.066, 16.269, 26.154, 36.358, 46.624, 56.764, 66.705, 76.373},
|
||||||
|
{-8.095, -3.300, 3.757, 11.501, 19.311, 27.113, 35.230, 44.010, 52.996, 61.415, 69.553},
|
||||||
|
{-0.226, 0.895, 2.538, 4.417, 6.472, 8.685, 11.052, 13.549, 16.097, 18.654, 21.101},
|
||||||
|
{-6.258, -5.650, -4.324, -2.444, -0.077, 2.687, 5.812, 9.235, 12.912, 16.802, 20.872}
|
||||||
|
};
|
||||||
|
|
||||||
|
//热电偶真值表,温度℃
|
||||||
|
// 行:[0,7]->[K, S, N, B, E, J, R, T],列:[0,10]->[Tmin,...,Tmax](均分成10个间隔,11个端点)
|
||||||
|
static float32 TC_TABLE_TEMP[8][11] =
|
||||||
|
{
|
||||||
|
{-270.0, -105.8, 58.4, 222.6, 386.8, 551.0, 715.2, 879.4, 1043.6, 1207.8, 1372.0},
|
||||||
|
{-50.0, 131.8, 313.6, 495.4, 677.2, 859.0, 1040.8, 1222.6, 1404.4, 1586.2, 1768.0},
|
||||||
|
{-270.0, -113.0, 44.0, 201.0, 358.0, 515.0, 672.0, 829.0, 986.0, 1143.0, 1300.0},
|
||||||
|
{0.0, 182.0, 364.0, 546.0, 728.0, 910.0, 1092.0, 1274.0, 1456.0, 1638.0, 1820.0},
|
||||||
|
{-270.0, -143.0, -16.0, 111.0, 238.0, 365.0, 492.0, 619.0, 746.0, 873.0, 1000.0},
|
||||||
|
{-210.0, -69.0, 72.0, 213.0, 354.0, 495.0, 636.0, 777.0, 918.0, 1059.0, 1200.0},
|
||||||
|
{-50.0, 131.8, 313.6, 495.4, 677.2, 859.0, 1040.8, 1222.6, 1404.4, 1586.2, 1768.0},
|
||||||
|
{-270.0, -203.0, -136.0, -69.0, -2.0, 65.0, 132.0, 199.0, 266.0, 333.0, 400.0}
|
||||||
|
};
|
||||||
|
|
||||||
|
//热电偶数据初始化
|
||||||
|
void TC_init(void)
|
||||||
|
{
|
||||||
|
//热电偶K
|
||||||
|
TC[0].tag = SIG_TC;
|
||||||
|
TC[0].typ = TC_K;
|
||||||
|
TC[0].low = TC_TABLE_TEMP[0][0];
|
||||||
|
TC[0].up = TC_TABLE_TEMP[0][10];
|
||||||
|
TC[0].pv = 0;
|
||||||
|
|
||||||
|
//热电偶S
|
||||||
|
TC[1].tag = SIG_TC;
|
||||||
|
TC[1].typ = TC_S;
|
||||||
|
TC[1].low = TC_TABLE_TEMP[1][0];
|
||||||
|
TC[1].up = TC_TABLE_TEMP[1][10];
|
||||||
|
TC[1].pv = 0;
|
||||||
|
|
||||||
|
//热电偶N
|
||||||
|
TC[2].tag = SIG_TC;
|
||||||
|
TC[2].typ = TC_N;
|
||||||
|
TC[2].low = TC_TABLE_TEMP[2][0];
|
||||||
|
TC[2].up = TC_TABLE_TEMP[2][10];
|
||||||
|
TC[2].pv = 0;
|
||||||
|
|
||||||
|
//热电偶B
|
||||||
|
TC[3].tag = SIG_TC;
|
||||||
|
TC[3].typ = TC_B;
|
||||||
|
TC[3].low = TC_TABLE_TEMP[3][0];;
|
||||||
|
TC[3].up = TC_TABLE_TEMP[3][10];;
|
||||||
|
TC[3].pv = 0;
|
||||||
|
|
||||||
|
//热电偶E
|
||||||
|
TC[4].tag = SIG_TC;
|
||||||
|
TC[4].typ = TC_E;
|
||||||
|
TC[4].low = TC_TABLE_TEMP[4][0];
|
||||||
|
TC[4].up = TC_TABLE_TEMP[4][10];
|
||||||
|
TC[4].pv = 0;
|
||||||
|
|
||||||
|
//热电偶J
|
||||||
|
TC[5].tag = SIG_TC;
|
||||||
|
TC[5].typ = TC_J;
|
||||||
|
TC[5].low = TC_TABLE_TEMP[5][0];
|
||||||
|
TC[5].up = TC_TABLE_TEMP[5][10];
|
||||||
|
TC[5].pv = 0;
|
||||||
|
|
||||||
|
//热电偶R
|
||||||
|
TC[6].tag = SIG_TC;
|
||||||
|
TC[6].typ = TC_R;
|
||||||
|
TC[6].low = TC_TABLE_TEMP[6][0];
|
||||||
|
TC[6].up = TC_TABLE_TEMP[6][10];
|
||||||
|
TC[6].pv = 0;
|
||||||
|
|
||||||
|
//热电偶T
|
||||||
|
TC[7].tag = SIG_TC;
|
||||||
|
TC[7].typ = TC_T;
|
||||||
|
TC[7].low = TC_TABLE_TEMP[7][0];
|
||||||
|
TC[7].up = TC_TABLE_TEMP[7][10];
|
||||||
|
TC[7].pv = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//物理量内容初始化
|
//物理量内容初始化
|
||||||
//底层数据,无法通过按键&菜单修改,用户使用时,仅修改tabdata里的变量
|
//底层数据,无法通过按键&菜单修改,用户使用时,仅修改tabdata里的变量
|
||||||
void physical_quantity_init(void)
|
void physical_quantity_init(void)
|
||||||
|
@ -51,61 +139,7 @@ void physical_quantity_init(void)
|
||||||
FRE.up = 100;
|
FRE.up = 100;
|
||||||
FRE.pv = 0;
|
FRE.pv = 0;
|
||||||
|
|
||||||
//热电偶K
|
TC_init();
|
||||||
TC[0].tag = SIG_TC;
|
|
||||||
TC[0].typ = TC_K;
|
|
||||||
TC[0].low = -270;
|
|
||||||
TC[0].up = 1372;
|
|
||||||
TC[0].pv = 0;
|
|
||||||
|
|
||||||
//热电偶S
|
|
||||||
TC[1].tag = SIG_TC;
|
|
||||||
TC[1].typ = TC_S;
|
|
||||||
TC[1].low = -50;
|
|
||||||
TC[1].up = 1768;
|
|
||||||
TC[1].pv = 0;
|
|
||||||
|
|
||||||
//热电偶N
|
|
||||||
TC[2].tag = SIG_TC;
|
|
||||||
TC[2].typ = TC_N;
|
|
||||||
TC[2].low = -270;
|
|
||||||
TC[2].up = 1300;
|
|
||||||
TC[2].pv = 0;
|
|
||||||
|
|
||||||
//热电偶B
|
|
||||||
TC[3].tag = SIG_TC;
|
|
||||||
TC[3].typ = TC_B;
|
|
||||||
TC[3].low = 0;
|
|
||||||
TC[3].up = 1820;
|
|
||||||
TC[3].pv = 0;
|
|
||||||
|
|
||||||
//热电偶E
|
|
||||||
TC[4].tag = SIG_TC;
|
|
||||||
TC[4].typ = TC_E;
|
|
||||||
TC[4].low = -270;
|
|
||||||
TC[4].up = 1000;
|
|
||||||
TC[4].pv = 0;
|
|
||||||
|
|
||||||
//热电偶J
|
|
||||||
TC[5].tag = SIG_TC;
|
|
||||||
TC[5].typ = TC_J;
|
|
||||||
TC[5].low = -210;
|
|
||||||
TC[5].up = 1200;
|
|
||||||
TC[5].pv = 0;
|
|
||||||
|
|
||||||
//热电偶R
|
|
||||||
TC[6].tag = SIG_TC;
|
|
||||||
TC[6].typ = TC_R;
|
|
||||||
TC[6].low = -50;
|
|
||||||
TC[6].up = 1768;
|
|
||||||
TC[6].pv = 0;
|
|
||||||
|
|
||||||
//热电偶T
|
|
||||||
TC[7].tag = SIG_TC;
|
|
||||||
TC[7].typ = TC_T;
|
|
||||||
TC[7].low = -270;
|
|
||||||
TC[7].up = 400;
|
|
||||||
TC[7].pv = 0;
|
|
||||||
|
|
||||||
RTD.tag = SIG_RTD;
|
RTD.tag = SIG_RTD;
|
||||||
RTD.typ = RTD_DC;
|
RTD.typ = RTD_DC;
|
||||||
|
|
|
@ -37,15 +37,16 @@ extern "C" {
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
|
#define FREQ_SYS 41472000
|
||||||
#define freq_operation(FREQ, PULSE) \
|
#define freq_operation(FREQ, PULSE) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (FREQ <= 0 || FREQ >= 41472000 || PULSE <= 0 || PULSE >= 100) \
|
if (FREQ <= 0 || FREQ >= FREQ_SYS || PULSE <= 0 || PULSE >= 100) \
|
||||||
{ \
|
{ \
|
||||||
HAL_TIMEx_PWMN_Stop(&htim1, TIM_CHANNEL_2); \
|
HAL_TIMEx_PWMN_Stop(&htim1, TIM_CHANNEL_2); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
uint16_t duty = 41472000 / FREQ; \
|
uint16_t duty = FREQ_SYS / FREQ; \
|
||||||
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2, duty *PULSE / 100 - 1); \
|
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2, duty *PULSE / 100 - 1); \
|
||||||
__HAL_TIM_SET_AUTORELOAD(&htim1, duty -1); \
|
__HAL_TIM_SET_AUTORELOAD(&htim1, duty -1); \
|
||||||
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2); \
|
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2); \
|
||||||
|
|
|
@ -173,100 +173,95 @@
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>3</count>
|
<count>3</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>mux_signal,0x0A</ItemText>
|
<ItemText>key,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>4</count>
|
<count>4</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>key,0x0A</ItemText>
|
<ItemText>pulse,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>5</count>
|
<count>5</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>pulse,0x0A</ItemText>
|
<ItemText>freq_signal</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>6</count>
|
<count>6</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>freq_signal</ItemText>
|
<ItemText>mux_signal</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>7</count>
|
<count>7</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>mux_signal</ItemText>
|
<ItemText>x1watch,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>8</count>
|
<count>8</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>x1watch,0x0A</ItemText>
|
<ItemText>y1watch,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>9</count>
|
<count>9</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>y1watch,0x0A</ItemText>
|
<ItemText>x2watch,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>10</count>
|
<count>10</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>x2watch,0x0A</ItemText>
|
<ItemText>y2watch,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>11</count>
|
<count>11</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>y2watch,0x0A</ItemText>
|
<ItemText>fswatch,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>12</count>
|
<count>12</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>fswatch,0x0A</ItemText>
|
<ItemText>m5data,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>13</count>
|
<count>13</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>m5data,0x0A</ItemText>
|
<ItemText>pltdata,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>14</count>
|
<count>14</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>pltdata,0x0A</ItemText>
|
<ItemText>tabdata,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>15</count>
|
<count>15</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>tabdata,0x0A</ItemText>
|
<ItemText>guider_ui,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>16</count>
|
<count>16</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>guider_ui,0x0A</ItemText>
|
<ItemText>VOL,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>17</count>
|
<count>17</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>VOL,0x0A</ItemText>
|
<ItemText>CUR,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>18</count>
|
<count>18</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>CUR,0x0A</ItemText>
|
<ItemText>RES,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>19</count>
|
<count>19</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>RES,0x0A</ItemText>
|
<ItemText>FRE,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>20</count>
|
<count>20</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>FRE,0x0A</ItemText>
|
|
||||||
</Ww>
|
|
||||||
<Ww>
|
|
||||||
<count>21</count>
|
|
||||||
<WinNumber>1</WinNumber>
|
|
||||||
<ItemText>TC,0x0A</ItemText>
|
<ItemText>TC,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>22</count>
|
<count>21</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>RTD,0x0A</ItemText>
|
<ItemText>RTD,0x0A</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue