全文预览

单片机课程设计(八路抢答器)

上传者:蓝天 |  格式:doc  |  页数:22 |  大小:0KB

文档介绍
0-f 显示 unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66, 0x6d,0x7d,0x07,0x7f,0x6f}; // 变量定义 sbit BEEP=P3^1; sbit start_stop = P3^2; sbit reset = P3^3; sbit key1 = P1^0; sbit key2 = P1^1; sbit key3 = P1^2; sbit key4 = P1^3; sbit key5 = P1^4; sbit key6 = P1^5; sbit key7 = P1^6; sbit key8 = P1^7; sbit state = P3^0; bit start_stop_flag = 0; bit key1_flag = 0; bit key2_flag = 0; bit key3_flag = 0; bit key4_flag = 0; bit key5_flag = 0; bit key6_flag = 0; bit key7_flag = 0; bit key8_flag = 0; bit reset_flag = 0; bit action = 0; uchar second = 20; uchar timer0_count = 0; uchar number = 0; uchar number_display = 0; uint flag = 1; // 延时函数 void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y= 120;y>0;y--); } // 蜂鸣器发声延时 void DelayMS(uint x) { uchar t; while(x--) for(t=0;t<100;t++); } // 数码管显示驱动函数

收藏

分享

举报
下载此文档