单片机实验板2011_V1.1-74HC244 按键测试程序

/************单片机教学实验板 ******************/
/*74HC244 按键测试程序*/
#include ac
#include
#include
#include
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
sbit speaker=P1^3; //蜂鸣器
sbit A13=P2^5; //
sbit R_D=P3^7; //
sbit D4=P0^4; //
sbit D5=P0^5; //
sbit D6=P0^6; //
sbit D7=P0^7; //
sbit LED_CS=P1^4;
void Key_Beep(void);
void Delay_Beep(unsigned int count);
/*****************按键声音********************/
void Key_Beep(void)
{ uchar i;
for (i=0;i<250;i++)
{ speaker=1;
Delay_Beep(5);
speaker=0;
Delay_Beep(5);
}
speaker=1;
}
/**************************************************/
/***************************蜂鸣器延时子程序start**********************/
void Delay_Beep(unsigned int count)
{
unsigned int i,j;
for(i=0;i
for(j=0;j<10;j++);
}
/***************************蜂鸣器延时子程序end************************/
/************主程序*************/
void main(void)
{
uchar key_num;
LED_CS=0;
A13=0;
R_D=0;
P0=0Xff;
Key_Beep();
Delay1ms(1000);
Key_Beep();
while(1)
{
;
}
}
关键词:
单片机74HC244按键测
评论