处理数据

先判断处理不为0的数据,再处理为0的数据,如果相反,导致有用的数据被处理掉
before_die
kafeijiaasamu 2 years ago
parent cb463c47d9
commit 52b421ac0f

Binary file not shown.

@ -29,7 +29,7 @@ Project File Date: 11/19/2023
Build target 'LED'
compiling myfreertos.c...
linking...
Program Size: Code=25408 RO-data=804 RW-data=1524 ZI-data=13220
Program Size: Code=25672 RO-data=804 RW-data=1524 ZI-data=13220
FromELF: creating hex file...
"..\OBJ\LED.axf" - 0 Error(s), 0 Warning(s).
@ -44,7 +44,7 @@ Package Vendor: Keil
D:\MDK5\ARM\Keil\STM32F1xx_DFP\2.3.0\Device\Include
<h2>Collection of Component Files used:</h2>
Build Time Elapsed: 00:00:02
Build Time Elapsed: 00:00:03
</pre>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
Dependencies for Project 'control', Target 'LED': (DO NOT MODIFY !)
CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
F (.\main.c)(0x6577C745)(--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 -ID:\MDK5\ARM\Keil\STM32F1xx_DFP\2.3.0\Device\Include -D__UVISION_VERSION="536" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
F (.\main.c)(0x6577FD18)(--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 -ID:\MDK5\ARM\Keil\STM32F1xx_DFP\2.3.0\Device\Include -D__UVISION_VERSION="536" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
I (..\myfreertos\myfreertos.h)(0x656FE939)
I (..\FreeRTOS\include\FreeRTOS.h)(0x652F9ABE)
I (D:\MDK5\ARM\ARMCC\include\stddef.h)(0x6025237E)
@ -2506,7 +2506,7 @@ I (..\FreeRTOS\portable\RVDS\ARM_CM3\portmacro.h)(0x573F3A17)
I (..\FreeRTOS\include\mpu_wrappers.h)(0x573F3A16)
I (..\FreeRTOS\include\task.h)(0x573F3A16)
I (..\FreeRTOS\include\list.h)(0x573F3A16)
F (..\myfreertos\myfreertos.c)(0x6577DA62)(--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 -ID:\MDK5\ARM\Keil\STM32F1xx_DFP\2.3.0\Device\Include -D__UVISION_VERSION="536" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\myfreertos.o --omf_browse ..\obj\myfreertos.crf --depend ..\obj\myfreertos.d)
F (..\myfreertos\myfreertos.c)(0x6578032A)(--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 -ID:\MDK5\ARM\Keil\STM32F1xx_DFP\2.3.0\Device\Include -D__UVISION_VERSION="536" -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 (..\FreeRTOS\include\FreeRTOS.h)(0x652F9ABE)
I (D:\MDK5\ARM\ARMCC\include\stddef.h)(0x6025237E)

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

@ -8,7 +8,7 @@ int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); //FreeRTOS推荐使用 中断优先级分组4
SysTick_Init(72);
USART2_Init(115200);
USART2_Init(2400);
PID_Init();
//printf("复位\r\n");
TimePwm_init(400-1,360-1);// 72M/400/360=500HZ
@ -26,7 +26,7 @@ int main(void)
// //RX_BUF_Init();
HC595_Send_Byte(0x02);//默认打开压缩机
TIM_SetCompare3(TIM3,170);
delay_xms(10000);//压缩机启动时10秒内以一半的额定功率工作
//delay_xms(10000);//压缩机启动时10秒内以一半的额定功率工作
//红白蓝对应J10 J11 J12
PWM_SetCompare1(0);//J10
PWM_SetCompare2(0);//J12

@ -190,7 +190,7 @@ void Sensor_Communication_task(void *pvParameters)
C= RS485_RX_BUF_COPY[19];
C = C<<8|RS485_RX_BUF_COPY[20];
//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->报警铃 GPIO2->压缩机 GPIO3->四通阀 GPIO4—>新风风扇 GPIO5->加湿器 */
@ -262,20 +262,23 @@ void Sensor_Communication_task(void *pvParameters)
else
{
int index=0;
//if()与while()的顺序不能变
if((RS485_RX_BUF_COPY[0]!=0x00))//不为0处理掉
{
RX_BUF_Transfer(0,1);
}
while(RS485_RX_BUF_COPY[index]==0x00)
{
index++;
}
RX_BUF_Transfer(0,index);
//printf("previous array cut\r\n");
printf("previous array cut\r\n");
// while(RS485_RX_BUF_COPY[0]==0x00)//前面数据为0删掉
// {
//RX_BUF_Transfer(0,1);
// }
if((RS485_RX_BUF_COPY[0]!=0x00))//不为0处理掉
{
RX_BUF_Transfer(0,1);
}
//RX_BUF_Printf(128);
}
@ -307,7 +310,7 @@ void Host_Computer_Communication(void)
if(RS485_RX_BUF_COPY[2]==0x03)//单个同步
{
Analysis(&n,&i,RS485_RX_BUF_COPY);
//printf("B6 03 cmd: batch sync\r\n");
printf("B6 03 cmd: batch sync\r\n");
Array(&now_stage,&hour,&min,&tem,&hum,&red,&blue,&white);//更新对应阶段号的参数
Write_Init();
RX_BUF_Transfer(0,11);
@ -316,18 +319,18 @@ void Host_Computer_Communication(void)
if(RS485_RX_BUF_COPY[2]==0x04)//阶段切换
{
change_stage_rev1=RS485_RX_BUF_COPY[3];
//printf("B6 04 cmd: change stage\r\n");
printf("B6 04 cmd: change stage\r\n");
RTC_synchronization_ins(2023,9,1,0,00,00);
now_stage=change_stage_rev1;
store_stage=change_stage_rev1;
Write_Init();
RX_BUF_Transfer(0,8);
//RX_BUF_Printf(128);
RX_BUF_Printf(128);
}
if(RS485_RX_BUF_COPY[2]==0x01)//批量同步
{
Batch_synchronization(&n,RS485_RX_BUF_COPY);
//printf("B6 01 cmd: get one %d\r\n", n);
printf("B6 01 cmd: get one %d\r\n", n);
Array(&now_stage,&hour,&min,&tem,&hum,&red,&blue,&white);//更新对应阶段号的参数
//Write_Init();减少擦写的次数
RX_BUF_Transfer(0,20);

Loading…
Cancel
Save