新增pid参数和out的上传

main
Zeng wei (曾威) 2 years ago
parent b6233c64cb
commit 3b2bf2e30e

@ -17,6 +17,8 @@ void PID_Init()
{ {
// pid.set_tem=tem;//用户设定温度 // pid.set_tem=tem;//用户设定温度
pid.Kp = 110; pid.Kp = 110;
pid.Ki = 0.001;
pid.Kd = 340;
pid.t = 500; // PID计算周期 pid.t = 500; // PID计算周期
// pid.Ti=5000000;//积分时间 // pid.Ti=5000000;//积分时间
// pid.Td=1000;//微分时间 // pid.Td=1000;//微分时间
@ -52,12 +54,12 @@ void PID_Calc() // pid
// ti=pid.t/pid.Ti; // ti=pid.t/pid.Ti;
// ki=ti*pid.Kp; // ki=ti*pid.Kp;
pid.Iout = ki * pid.SEk; // 积分输出 pid.Iout = pid.Ki * pid.SEk; // 积分输出
// td=pid.Td/pid.t; // td=pid.Td/pid.t;
// kd=pid.Kp*td; // kd=pid.Kp*td;
pid.Dout = kd * DelEk; // 微分输出 pid.Dout = pid.Kd * DelEk; // 微分输出
if (pid.Dout < 0) if (pid.Dout < 0)
{ {
pid.Dout = 0 - pid.Dout; pid.Dout = 0 - pid.Dout;
@ -82,39 +84,38 @@ void PID_Calc() // pid
if (pid.set_tem > pid.now_tem + 1) if (pid.set_tem > pid.now_tem + 1)
{ {
// 得到当前的偏差值设置温度大于实际温度1℃加热关闭压缩机,打开加热棒 // 得到当前的偏差值设置温度大于实际温度1℃加热close compressoropen heater
/*GPIO1->报警铃 GPIO6->压缩机 GPIO3->加热棒 GPIO4—>新风风扇 GPIO5->加湿器 */ /*GPIO1->报警铃 GPIO3->heater GPIO4—>新风风扇 GPIO5->加湿器 GPIO6->compressor */
// HC595_Send_Byte(gpio_state&=0xDF);//关闭压缩机 &=1101 1111 0xDF HC595_Send_Byte(gpio_state &= 0xDF);//close compressor &=1101 1111 0xDF
TIM_SetCompare3(TIM3, 0); TIM_SetCompare3(TIM3, 0);
HC595_Send_Byte(gpio_state |= 0x04); // 打开加热棒 |=0000 0100 0x04 HC595_Send_Byte(gpio_state |= 0x04); // open heater |=0000 0100 0x04
hot_clod_flag = 2; hot_clod_flag = 2;
pid.Iout = 0; pid.Iout = 0;
} } else if (pid.now_tem > pid.set_tem)
if (pid.now_tem > pid.set_tem)
{ {
// 得到当前的偏差值,设置温度小于实际温度,制冷,打开压缩机,关闭加热棒 // 得到当前的偏差值设置温度小于实际温度制冷open compressorclose heater
HC595_Send_Byte(gpio_state &= 0xFB); // 关闭加热棒 &=1111 1011 0xFB HC595_Send_Byte(gpio_state &= 0xFB); // close heater &=1111 1011 0xFB
num = (((pid.OUT * 400) / pid.pwmcycle) - 1); // 请问这个pid.OUT与pwm占空比的值是如何换算过来的
TIM_SetCompare3(TIM3, num);
// printf("%d\r\n",num);
// 0-200对应0-100%如果pid.out=50,占空比就是25%//num=50*400/200=100100/400=25% // 0-200对应0-100%如果pid.out=50,占空比就是25%//num=50*400/200=100100/400=25%
// HC595_Send_Byte(gpio_state|=0x20);//打开压缩机 |=0010 0000 // TODO:: change maxinum from 400 to 300
num = (((pid.OUT * 400) / pid.pwmcycle) - 1); // pid.OUT与pwm占空比的值换算
TIM_SetCompare3(TIM3, num / 4);
// printf("%d\r\n",num);
HC595_Send_Byte(gpio_state|=0x20);//open compressor |=0010 0000
hot_clod_flag = 1; hot_clod_flag = 1;
// pid.Iout=0; // pid.Iout=0;
} }
if (hot_clod_flag == 1 && T <= tem - 3) // 制冷过程中温度下降低于设定温度0.3℃ if (hot_clod_flag == 1 && T <= tem - 3) // 制冷过程中温度下降低于设定温度0.3℃
{ {
// HC595_Send_Byte(gpio_state&=0xDB);//关闭压缩机 关闭加热棒 &=1101 1101 0xDB HC595_Send_Byte(gpio_state&=0xDB);// close compressor and heater &=1101 1011 0xDB
TIM_SetCompare3(TIM3, 0); // 关闭压缩机 TIM_SetCompare3(TIM3, 0); // close compressor
HC595_Send_Byte(gpio_state &= 0xFB); // 关闭加热棒
hot_clod_flag = 0; hot_clod_flag = 0;
} }
if (hot_clod_flag == 2 && T >= tem) if (hot_clod_flag == 2 && T >= tem) // while heat, T above tem
{ {
// HC595_Send_Byte(gpio_state&=0xDB);//关闭压缩机 关闭四通阀 &=1101 1101 0xDB HC595_Send_Byte(gpio_state&=0xDB);//close compressor and heater &=1101 1011 0xDB
TIM_SetCompare3(TIM3, 0); // 关闭压缩机 TIM_SetCompare3(TIM3, 0); // close compressor
HC595_Send_Byte(gpio_state &= 0xFB); // 关闭加热棒
hot_clod_flag = 0; hot_clod_flag = 0;
} }
// HC595_Send_Byte(gpio_state&=0xDB);// close compressor and heater &=1101 1011 0xDB
} }

@ -9,10 +9,12 @@ typedef struct Pid
float set_tem;//用户设定值 float set_tem;//用户设定值
float now_tem;//当前温度 float now_tem;//当前温度
float Kp; float Kp; // 110
int t; //PID计算周期--采样周期 int t; //PID计算周期--采样周期
float Ti; float Ti;
float Td; float Td;
float Ki; // 0.001
float Kd; // 340
float Ek; //本次偏差 float Ek; //本次偏差
float Ek_1;//上次偏差 float Ek_1;//上次偏差

@ -4,8 +4,8 @@
#include "Relays.h" #include "Relays.h"
#include "myfreertos.h" #include "myfreertos.h"
u8 sendbuf[29] = {0xEE, 0xB5, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, u8 sendbuf[37] = {0xEE, 0xB5, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF}; // 发送给串口屏的实时数据 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF}; // 发送给串口屏的实时数据
u8 sendbuf_crc[20] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, u8 sendbuf_crc[20] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
extern u8 global_buffer[64]; extern u8 global_buffer[64];
@ -45,6 +45,7 @@ u8 crc_num2 = 0xFF;
extern int T; extern int T;
extern int H; extern int H;
extern int C; extern int C;
extern PID pid;
// extern u16 RED_LIGHT; // extern u16 RED_LIGHT;
// extern u16 WHITE_LIGHT; // extern u16 WHITE_LIGHT;
// extern u16 BLUE_LIGHT; // extern u16 BLUE_LIGHT;
@ -366,10 +367,10 @@ void RS485_1_Send_Data_2(void) //
sendbuf[0] = 0xEE; sendbuf[0] = 0xEE;
sendbuf[1] = 0xB5; sendbuf[1] = 0xB5;
sendbuf[2] = 0x05; sendbuf[2] = 0x05;
sendbuf[25] = 0xFF; sendbuf[33] = 0xFF;
sendbuf[26] = 0xFC; sendbuf[34] = 0xFC;
sendbuf[27] = 0xFF; sendbuf[35] = 0xFF;
sendbuf[28] = 0xFF; sendbuf[36] = 0xFF;
u8 a; u8 a;
RS485_1_TX_EN = 1; // ÉèÖÃΪ·¢ËÍģʽ RS485_1_TX_EN = 1; // ÉèÖÃΪ·¢ËÍģʽ
if (T <= 500000) if (T <= 500000)
@ -419,20 +420,30 @@ void RS485_1_Send_Data_2(void) //
sendbuf[14] = CO2_2; sendbuf[14] = CO2_2;
if (now_stage < 7 && total[3 + 18 * (now_stage - 1)] < 24 && total[4 + 18 * (now_stage - 1)] < 60 && chour < 24 && cminute < 60) if (now_stage < 7 && total[3 + 18 * (now_stage - 1)] < 24 && total[4 + 18 * (now_stage - 1)] < 60 && chour < 24 && cminute < 60)
{ {
sendbuf[15] = now_stage; // 当前阶段 sendbuf[15] = now_stage; // current state
sendbuf[16] = total[3 + 18 * (now_stage - 1)]; // 阶段小时 sendbuf[16] = total[3 + 18 * (now_stage - 1)]; // stage hour
sendbuf[17] = total[4 + 18 * (now_stage - 1)]; // 阶段分钟 sendbuf[17] = total[4 + 18 * (now_stage - 1)]; // stage minute
sendbuf[18] = chour; // 已运行小时数 sendbuf[18] = chour; // run hour
sendbuf[19] = cminute; // 已运行分钟数 sendbuf[19] = cminute; // run minute
} }
sendbuf[20] = hot_clod_flag; // 加热制冷状态 sendbuf[20] = hot_clod_flag; // hot clod state
sendbuf[21] = humidity_flag; // 加湿干燥状态 sendbuf[21] = humidity_flag; // humidity state
sendbuf[22] = ALARM; // 报警状态状态 sendbuf[22] = ALARM; // ALARM state
bufcut_Init(sendbuf_crc, sendbuf, 3, 23); sendbuf[23] = (int)pid.Kp / 256; // Kp 110
GetCRC16(sendbuf_crc, 20, &crc_num1, &crc_num2); sendbuf[24] = (int)pid.Kp % 256; // Kp 110
sendbuf[23] = crc_num1; sendbuf[25] = ((int)(pid.Ki * 100000)) / 256; // Ti 0.001
sendbuf[24] = crc_num2; sendbuf[26] = ((int)(pid.Ki * 100000)) % 256; // Ti 0.001
sendbuf[27] = (int)pid.Kd / 256; // Td 340
sendbuf[28] = (int)pid.Kd % 256; // Td 340
// num = (((pid.OUT * 350) / pid.pwmcycle) - 1);
sendbuf[29] = ((int)(pid.OUT * 1000)) / 256;
sendbuf[30] = ((int)(pid.OUT * 1000)) % 256;
bufcut_Init(sendbuf_crc, sendbuf, 3, 31);
GetCRC16(sendbuf_crc, 28, &crc_num1, &crc_num2);
sendbuf[31] = crc_num1;
sendbuf[32] = crc_num2;
// for(int i=0;i<20;i++) // for(int i=0;i<20;i++)
// { // {
// printf("%x ",sendbuf_crc[i]); // printf("%x ",sendbuf_crc[i]);
@ -446,7 +457,7 @@ void RS485_1_Send_Data_2(void) //
// } // }
// printf("%x\r\n",sendbuf[0]); // printf("%x\r\n",sendbuf[0]);
for (a = 0; a < 29; a++) // 循环发送数据 for (a = 0; a < 37; a++) // 循环发送数据
{ {
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
; ;

Binary file not shown.

@ -26,12 +26,101 @@ Project File Date: 01/08/2024
<h2>Output:</h2> <h2>Output:</h2>
*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin' *** Using Compiler 'V5.06 update 4 (build 422)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin'
Build target 'LED' Rebuild target 'LED'
compiling PID.c...
compiling MYSPI.c...
compiling iwdg.c...
compiling system_stm32f10x.c...
compiling USART.c...
assembling startup_stm32f10x_md.s...
compiling core_cm3.c...
compiling Relays.c...
compiling write.c...
compiling main.c...
compiling stm32f10x_gpio.c...
compiling SysTick.c...
compiling PWMOUT.c...
compiling W25Q128.c...
compiling misc.c...
compiling stm32f10x_cec.c...
compiling bufcut.c...
compiling stm32f10x_bkp.c...
compiling OSC.c...
compiling stm32f10x_it.c...
compiling stm32f10x_dbgmcu.c...
compiling stm32f10x_rcc.c...
compiling stm32f10x_adc.c...
compiling system.c...
compiling stm32f10x_crc.c...
compiling stm32f10x_dac.c...
compiling rtc.c...
compiling stm32f10x_usart.c...
compiling stm32f10x_dma.c...
compiling PWM.c...
compiling stm32f10x_can.c...
compiling rs485.c...
compiling stm32f10x_exti.c...
compiling stm32f10x_flash.c...
compiling stm32f10x_pwr.c...
compiling stm32f10x_iwdg.c...
compiling stm32f10x_rtc.c...
compiling stm32f10x_i2c.c...
compiling stm32f10x_fsmc.c...
compiling stm32f10x_sdio.c...
compiling utility.c...
compiling stm32f10x_spi.c...
compiling stm32f10x_wwdg.c...
compiling spi.c...
compiling socket.c...
compiling stm32f10x_tim.c...
compiling w5500api.c...
compiling cJSON.c...
..\MQTT\lib\cJSON.c(30): warning: #1293-D: assignment in condition
if (!(copy = (char*)cJSON_malloc(len)))
..\MQTT\lib\cJSON.c(254): warning: #1293-D: assignment in condition
ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t",token)) len++; else if (token<32) len+=5;ptr++;}
..\MQTT\lib\cJSON.c(328): warning: #111-D: statement is unreachable
return p.buffer;
..\MQTT\lib\cJSON.c(399): warning: #1293-D: assignment in condition
if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */
..\MQTT\lib\cJSON.c(511): warning: #1293-D: assignment in condition
if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */
..\MQTT\lib\cJSON.c: 5 warnings, 0 errors
compiling w5500.c...
compiling dns.c...
compiling dhcp.c...
compiling MQTTConnectClient.c...
compiling MQTTConnectServer.c...
compiling MQTTDeserializePublish.c...
compiling MQTTFormat.c...
..\MQTT\lib\MQTTFormat.c(122): warning: #550-D: variable "strindex" was set but never used
int strindex = 0;
..\MQTT\lib\MQTTFormat.c(200): warning: #550-D: variable "rc" was set but never used
int rc;
..\MQTT\lib\MQTTFormat.c(190): warning: #550-D: variable "strindex" was set but never used
int strindex = 0;
..\MQTT\lib\MQTTFormat.c: 3 warnings, 0 errors
compiling MQTTPacket.c...
compiling MQTTSerializePublish.c...
compiling MQTTSubscribeClient.c...
compiling MQTTUnsubscribeClient.c...
compiling MQTTSubscribeServer.c...
compiling MQTTUnsubscribeServer.c...
compiling mqtt_api.c...
compiling md5.c...
compiling croutine.c...
compiling event_groups.c...
compiling list.c...
compiling tasks.c...
compiling timers.c...
compiling heap_4.c...
compiling queue.c...
compiling port.c...
compiling myfreertos.c... compiling myfreertos.c...
linking... linking...
Program Size: Code=25408 RO-data=804 RW-data=1524 ZI-data=13220 Program Size: Code=25748 RO-data=804 RW-data=1532 ZI-data=13228
FromELF: creating hex file... FromELF: creating hex file...
"..\OBJ\LED.axf" - 0 Error(s), 0 Warning(s). "..\OBJ\LED.axf" - 0 Error(s), 8 Warning(s).
<h2>Collection of Component include folders:</h2> <h2>Collection of Component include folders:</h2>
.\RTE\_LED .\RTE\_LED

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

@ -52,7 +52,7 @@ I (..\HARDWARE\PWM.h)(0x655DC5F0)
I (..\HARDWARE\rtc.h)(0x656019C4) I (..\HARDWARE\rtc.h)(0x656019C4)
I (..\HARDWARE\bufcut.h)(0x6537353D) I (..\HARDWARE\bufcut.h)(0x6537353D)
I (..\HARDWARE\iwdg.h)(0x64FC32D3) I (..\HARDWARE\iwdg.h)(0x64FC32D3)
I (..\HARDWARE\PID.h)(0x6559C02A) I (..\HARDWARE\PID.h)(0x65AA5F50)
I (..\HARDWARE\PWMOUT.h)(0x659B5EBC) I (..\HARDWARE\PWMOUT.h)(0x659B5EBC)
I (..\w5500\w5500api.h)(0x65712928) I (..\w5500\w5500api.h)(0x65712928)
I (..\w5500\spi.h)(0x65093ED0) I (..\w5500\spi.h)(0x65093ED0)
@ -328,7 +328,7 @@ I (..\HARDWARE\OSC.h)(0x64E6C94A)
I (..\HARDWARE\PWM.h)(0x655DC5F0) I (..\HARDWARE\PWM.h)(0x655DC5F0)
I (..\HARDWARE\bufcut.h)(0x6537353D) I (..\HARDWARE\bufcut.h)(0x6537353D)
I (..\HARDWARE\iwdg.h)(0x64FC32D3) I (..\HARDWARE\iwdg.h)(0x64FC32D3)
I (..\HARDWARE\PID.h)(0x6559C02A) I (..\HARDWARE\PID.h)(0x65AA5F50)
I (..\HARDWARE\PWMOUT.h)(0x659B5EBC) I (..\HARDWARE\PWMOUT.h)(0x659B5EBC)
I (..\w5500\w5500api.h)(0x65712928) I (..\w5500\w5500api.h)(0x65712928)
I (..\w5500\spi.h)(0x65093ED0) I (..\w5500\spi.h)(0x65093ED0)
@ -374,7 +374,7 @@ I (..\SYSTEM\system.h)(0x64BC0671)
I (D:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x57F606B8) I (D:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x57F606B8)
I (..\SYSTEM\SysTick.h)(0x6530E176) I (..\SYSTEM\SysTick.h)(0x6530E176)
F (..\HARDWARE\OSC.h)(0x64E6C94A)() F (..\HARDWARE\OSC.h)(0x64E6C94A)()
F (..\HARDWARE\rs485.c)(0x659BC4F6)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\rs485.o --omf_browse ..\obj\rs485.crf --depend ..\obj\rs485.d) F (..\HARDWARE\rs485.c)(0x65AA6099)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\rs485.o --omf_browse ..\obj\rs485.crf --depend ..\obj\rs485.d)
I (..\HARDWARE\rs485.h)(0x656565E2) I (..\HARDWARE\rs485.h)(0x656565E2)
I (..\USER\stm32f10x.h)(0x4D783CB5) I (..\USER\stm32f10x.h)(0x4D783CB5)
I (..\CORE\core_cm3.h)(0x4D523B58) I (..\CORE\core_cm3.h)(0x4D523B58)
@ -427,7 +427,7 @@ I (..\HARDWARE\PWM.h)(0x655DC5F0)
I (..\HARDWARE\rtc.h)(0x656019C4) I (..\HARDWARE\rtc.h)(0x656019C4)
I (..\HARDWARE\bufcut.h)(0x6537353D) I (..\HARDWARE\bufcut.h)(0x6537353D)
I (..\HARDWARE\iwdg.h)(0x64FC32D3) I (..\HARDWARE\iwdg.h)(0x64FC32D3)
I (..\HARDWARE\PID.h)(0x6559C02A) I (..\HARDWARE\PID.h)(0x65AA5F50)
I (..\HARDWARE\PWMOUT.h)(0x659B5EBC) I (..\HARDWARE\PWMOUT.h)(0x659B5EBC)
I (..\w5500\w5500api.h)(0x65712928) I (..\w5500\w5500api.h)(0x65712928)
I (..\w5500\spi.h)(0x65093ED0) I (..\w5500\spi.h)(0x65093ED0)
@ -538,8 +538,8 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415F)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4) I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4) I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
F (..\HARDWARE\iwdg.h)(0x64FC32D3)() F (..\HARDWARE\iwdg.h)(0x64FC32D3)()
F (..\HARDWARE\PID.c)(0x659B5F29)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\pid.o --omf_browse ..\obj\pid.crf --depend ..\obj\pid.d) F (..\HARDWARE\PID.c)(0x65AF75D5)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\pid.o --omf_browse ..\obj\pid.crf --depend ..\obj\pid.d)
I (..\HARDWARE\PID.h)(0x6559C02A) I (..\HARDWARE\PID.h)(0x65AA5F50)
I (..\HARDWARE\Relays.h)(0x6559CD68) I (..\HARDWARE\Relays.h)(0x6559CD68)
I (..\SYSTEM\system.h)(0x64BC0671) I (..\SYSTEM\system.h)(0x64BC0671)
I (..\USER\stm32f10x.h)(0x4D783CB5) I (..\USER\stm32f10x.h)(0x4D783CB5)
@ -572,7 +572,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4) I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
I (..\SYSTEM\USART.h)(0x655DAB3D) I (..\SYSTEM\USART.h)(0x655DAB3D)
I (D:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x57F606B8) I (D:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x57F606B8)
F (..\HARDWARE\PID.h)(0x6559C02A)() F (..\HARDWARE\PID.h)(0x65AA5F50)()
F (..\HARDWARE\PWMOUT.c)(0x659B5EBC)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\pwmout.o --omf_browse ..\obj\pwmout.crf --depend ..\obj\pwmout.d) F (..\HARDWARE\PWMOUT.c)(0x659B5EBC)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\pwmout.o --omf_browse ..\obj\pwmout.crf --depend ..\obj\pwmout.d)
I (..\HARDWARE\PWMOUT.h)(0x659B5EBC) I (..\HARDWARE\PWMOUT.h)(0x659B5EBC)
I (..\SYSTEM\system.h)(0x64BC0671) I (..\SYSTEM\system.h)(0x64BC0671)
@ -604,7 +604,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x64FD7190)
I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415F) I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415F)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4) I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4) I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
I (..\HARDWARE\PID.h)(0x6559C02A) I (..\HARDWARE\PID.h)(0x65AA5F50)
F (..\HARDWARE\PWMOUT.h)(0x659B5EBC)() F (..\HARDWARE\PWMOUT.h)(0x659B5EBC)()
F (..\SYSTEM\system.c)(0x64BC066E)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\system.o --omf_browse ..\obj\system.crf --depend ..\obj\system.d) F (..\SYSTEM\system.c)(0x64BC066E)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\system.o --omf_browse ..\obj\system.crf --depend ..\obj\system.d)
I (..\SYSTEM\system.h)(0x64BC0671) I (..\SYSTEM\system.h)(0x64BC0671)
@ -2507,7 +2507,7 @@ I (..\FreeRTOS\portable\RVDS\ARM_CM3\portmacro.h)(0x573F3A17)
I (..\FreeRTOS\include\mpu_wrappers.h)(0x573F3A16) I (..\FreeRTOS\include\mpu_wrappers.h)(0x573F3A16)
I (..\FreeRTOS\include\task.h)(0x573F3A16) I (..\FreeRTOS\include\task.h)(0x573F3A16)
I (..\FreeRTOS\include\list.h)(0x573F3A16) I (..\FreeRTOS\include\list.h)(0x573F3A16)
F (..\myfreertos\myfreertos.c)(0x659CA244)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\myfreertos.o --omf_browse ..\obj\myfreertos.crf --depend ..\obj\myfreertos.d) F (..\myfreertos\myfreertos.c)(0x65AE5EE8)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ..\USER -I ..\CORE -I ..\STM32F10x_FWLib\inc -I ..\HARDWARE -I ..\SYSTEM -I ..\dhcp -I ..\dns -I ..\md5 -I ..\MQTT -I ..\MQTT\lib -I ..\w5500 -I ..\FreeRTOS\include -I ..\FreeRTOS\portable\RVDS\ARM_CM3 -I ..\myfreertos -I.\RTE\_LED -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="523" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\myfreertos.o --omf_browse ..\obj\myfreertos.crf --depend ..\obj\myfreertos.d)
I (..\myfreertos\myfreertos.h)(0x656FE939) I (..\myfreertos\myfreertos.h)(0x656FE939)
I (..\FreeRTOS\include\FreeRTOS.h)(0x652F9ABE) I (..\FreeRTOS\include\FreeRTOS.h)(0x652F9ABE)
I (D:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x57F606B8) I (D:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x57F606B8)
@ -2560,7 +2560,7 @@ I (..\HARDWARE\PWM.h)(0x655DC5F0)
I (..\HARDWARE\rtc.h)(0x656019C4) I (..\HARDWARE\rtc.h)(0x656019C4)
I (..\HARDWARE\bufcut.h)(0x6537353D) I (..\HARDWARE\bufcut.h)(0x6537353D)
I (..\HARDWARE\iwdg.h)(0x64FC32D3) I (..\HARDWARE\iwdg.h)(0x64FC32D3)
I (..\HARDWARE\PID.h)(0x6559C02A) I (..\HARDWARE\PID.h)(0x65AA5F50)
I (..\HARDWARE\PWMOUT.h)(0x659B5EBC) I (..\HARDWARE\PWMOUT.h)(0x659B5EBC)
I (..\w5500\w5500api.h)(0x65712928) I (..\w5500\w5500api.h)(0x65712928)
I (..\w5500\spi.h)(0x65093ED0) I (..\w5500\spi.h)(0x65093ED0)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -164,6 +164,7 @@ void Sensor_Communication_task(void *pvParameters)
// RX_BUF_Printf(128); // RX_BUF_Printf(128);
bufcut_Init(RS485_RX_BUF_COPY, RS485_RX_BUF, 0, 128); bufcut_Init(RS485_RX_BUF_COPY, RS485_RX_BUF, 0, 128);
RS485_RX_CNT = 0; RS485_RX_CNT = 0;
// HC595_Send_Byte(0x00); // close all
while ((isAllZeros(RS485_RX_BUF_COPY, 128) == 0)) while ((isAllZeros(RS485_RX_BUF_COPY, 128) == 0))
// while(!(RS485_RX_BUF[0]==0x00 && RS485_RX_BUF[1]==0x00&&RS485_RX_BUF[2]==0x00 && RS485_RX_BUF[3]==0x00)) // while(!(RS485_RX_BUF[0]==0x00 && RS485_RX_BUF[1]==0x00&&RS485_RX_BUF[2]==0x00 && RS485_RX_BUF[3]==0x00))
{ {
@ -179,7 +180,7 @@ void Sensor_Communication_task(void *pvParameters)
T = T << 8 | RS485_RX_BUF_COPY[4]; T = T << 8 | RS485_RX_BUF_COPY[4];
// 支持负数温度 // 支持负数温度
if (T & 0x8000) { if (T & 0x8000) {
T = ((~T + 1) & 0xFFFF); T = ((~T + 1) & 0xFFFF);
} }
H = RS485_RX_BUF_COPY[5]; H = RS485_RX_BUF_COPY[5];
@ -190,9 +191,9 @@ void Sensor_Communication_task(void *pvParameters)
// printf("now_tem=%d.%d℃,now_hum=%d.%d%% ,co2=%d\r\n",T/10,T%10,H/10,H%10,C); // printf("now_tem=%d.%d℃,now_hum=%d.%d%% ,co2=%d\r\n",T/10,T%10,H/10,H%10,C);
/*GPIO1->报警铃 GPIO6->压缩机 GPIO3->加热棒 GPIO4—>新风风扇 GPIO5->加湿器 */ /*GPIO1->报警铃 GPIO3->加热棒 GPIO4—>新风风扇 GPIO5->加湿器 GPIO6->压缩机 */
if ((T < (tem - 20) || T > (tem + 20) || H < (hum - 100) || H > (hum + 100)) && (tick > 610)) // 温度偏差2℃报警湿度偏差10报警 if ((T < (tem - 20) || T > (tem + 20) || H < (hum - 100) || H > (hum + 100)) && (tick > 600)) // 温度偏差2℃报警湿度偏差10报警
{ {
HC595_Send_Byte(gpio_state |= 0x01); // 打开报警铃 GPIO1->PB1 |=0000 0001 0x01 HC595_Send_Byte(gpio_state |= 0x01); // 打开报警铃 GPIO1->PB1 |=0000 0001 0x01
ALARM = 1; ALARM = 1;
@ -325,8 +326,9 @@ void Sensor_Communication_task(void *pvParameters)
// printf("previous array cut\r\n"); // printf("previous array cut\r\n");
// RX_BUF_Printf(128); // RX_BUF_Printf(128);
} }
// HC595_Send_Byte(0x00); // HC595_Send_Byte(0x0F);
} }
// HC595_Send_Byte(0x0F); // close all
// printf("%d,%d,%d\r\n",T,H,C); // printf("%d,%d,%d\r\n",T,H,C);
// printf("current params: %d:%d,hot or cold flag:%d, humidity flag:%d, alarm: %d\r\n",chour, cminute, hot_clod_flag, humidity_flag, ALARM); // printf("current params: %d:%d,hot or cold flag:%d, humidity flag:%d, alarm: %d\r\n",chour, cminute, hot_clod_flag, humidity_flag, ALARM);

Loading…
Cancel
Save