From 12fe1b13c786be6ca22a40ecf82ff3368429c412 Mon Sep 17 00:00:00 2001 From: fengbh <1953356163@qq.com> Date: Mon, 15 Jul 2024 01:22:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/public.h | 7 +++++++ src/main.c | 28 ---------------------------- src/public.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/include/public.h b/include/public.h index 499afe6..79ccbea 100644 --- a/include/public.h +++ b/include/public.h @@ -7,8 +7,15 @@ typedef unsigned int u16; typedef unsigned char u8; +// 用于自动重启的变量 +__sfr __at (0xE7) ISP_CONTR; +#define RESET_PASSWORD_LENGTH 6 +extern char __xdata reset_password[RESET_PASSWORD_LENGTH]; +extern char __xdata receice_password[RESET_PASSWORD_LENGTH]; + void delay_10us(u16 ten_us); void delay_ms(u16 ms); +u8 auto_reset(u8 rec_data); #endif diff --git a/src/main.c b/src/main.c index b684124..c4ffa2d 100644 --- a/src/main.c +++ b/src/main.c @@ -17,35 +17,7 @@ int HH=0, MM=0, SS=0; int send_tmp = 0; -__sfr __at (0xE7) ISP_CONTR; -#define RESET_PASSWORD_LENGTH 6 -char __xdata reset_password[RESET_PASSWORD_LENGTH] = "RESET"; -char __xdata receice_password[RESET_PASSWORD_LENGTH] = {0}; -/******************************************************************************* -* 函 数 名 : auto_reset -* 函数功能 : 接受到重启命令RESET!后,软复位MCU -* 输 入 : 无 -* 输 出 : 0:检测到重启命令,1:未检测到重启命令 -*******************************************************************************/ -u8 auto_reset(u8 rec_data) -{ - for(u8 i=0;i0;i--) for(j=110;j>0;j--); +} + +/******************************************************************************* +* 函 数 名 : auto_reset +* 函数功能 : 接受到重启命令RESET!后,软复位MCU +* 输 入 : 无 +* 输 出 : 0:检测到重启命令,1:未检测到重启命令 +*******************************************************************************/ +char __xdata reset_password[RESET_PASSWORD_LENGTH] = "RESET"; +char __xdata receice_password[RESET_PASSWORD_LENGTH] = {0}; +u8 auto_reset(u8 rec_data) +{ + for(u8 i=0;i