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