您的位置 首页 动态

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

/************单片机教学实验板******************//*74HC244按键测试程序*/#includereg52.h>ac#includeSTC_Delay.h&gt

/************单片机教育试验板 ******************/
/*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)
{
;
}
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/news/dongtai/267248.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部