From 3334d7896c2750905feee385b9126d249205a1d2 Mon Sep 17 00:00:00 2001 From: fengbh <1953356163@qq.com> Date: Mon, 15 Jan 2024 21:03:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=9C=A8=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=B8=AD=E6=96=AD=E4=B8=AD=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 06091c0..90777ec 100644 --- a/src/main.c +++ b/src/main.c @@ -16,7 +16,7 @@ #include "time0.h" int HH=0, MM=0, SS=0; -int temp_value=0; +int send_tmp = 0; /******************************************************************************* * 函 数 名 : main * 函数功能 : 主函数 @@ -27,6 +27,7 @@ void main(void) { u8 i=0; u8 temp_buf[5]; + int temp_value = 0; uart_init(0XFA);//波特率为9600 ds18b20_init();//初始化DS18B20 @@ -53,7 +54,10 @@ void main(void) smg_display(temp_buf,4); // 串口打印 - // printf("temp = %.1f\n", temp_value/10.0); + if(send_tmp == 1) { + send_tmp = 0; + printf("%02d:%02d:%02d temp = %.1f\r\n", HH, MM, SS, temp_value/10.0); + } } } @@ -85,7 +89,7 @@ void time0(void) __interrupt (1) //定时器0中断函数 if(i==1000) { i=0; - LED1=!LED1; + send_tmp = 1; SS ++; if (SS == 60){ @@ -96,6 +100,5 @@ void time0(void) __interrupt (1) //定时器0中断函数 MM = 0; HH ++; } - printf("%02d:%02d:%02d temp = %.1f\r\n", HH, MM, SS, temp_value/10.0); } } \ No newline at end of file