从单片机基础到程序框架(全集 2019pdf版) - 第511页

void BeepO pen(void) { P3_4=0; } void BeepC lose(void ) { P3_4=1; } void LedOp en_P1_4(v oid) { P1_4=0; } void LedCl ose_P1_4( void) { P1_4=1; } void LedOp en_P1_5(v oid) { P1_5=0; } void LedCl ose_P1_5( void) { P1_5=1; …

100%1 / 836
VoiceScan();
KeyScan();
TH0=0xfc;
TL0=0x66;
}
void SystemInitial(void)
{
TMOD=0x01;
TH0=0xfc;
TL0=0x66;
EA=1;
ET0=1;
TR0=1;
}
void Delay(unsigned long u32DelayTime)
{
for(;u32DelayTime>0;u32DelayTime--);
}
void PeripheralInitial(void)
{
if(0==Gu8LedStatus_P1_4)
{
LedClose_P1_4();
}
else
{
LedOpen_P1_4();
}
if(0==Gu8LedStatus_P1_5)
{
LedClose_P1_5();
}
else
{
LedOpen_P1_5();
}
}
void BeepOpen(void)
{
P3_4=0;
}
void BeepClose(void)
{
P3_4=1;
}
void LedOpen_P1_4(void)
{
P1_4=0;
}
void LedClose_P1_4(void)
{
P1_4=1;
}
void LedOpen_P1_5(void)
{
P1_5=0;
}
void LedClose_P1_5(void)
{
P1_5=1;
}
void VoiceScan(void)
{
static unsigned char Su8Lock=0;
if(1==vGu8BeepTimerFlag&&vGu16BeepTimerCnt>0)
{
if(0==Su8Lock)
{
Su8Lock=1;
BeepOpen();
}
else
{
vGu16BeepTimerCnt--;
if(0==vGu16BeepTimerCnt)
{
Su8Lock=0;
BeepClose();
}
}
}
}