附件
(1)系统原理图
R1~810KJ3DPY2B1A2A1B2B1C2C1D2D1E2E1F2F1G21GDP382615812161115101774913+5VC1USBVCC32GND+5V30PFY112MHZC21830PF919X1X2RESET+5V40U1P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7RXDTXDINT0INT1T0T1WRRDAT89C5139383736353433322122232425262728101112131415161712345678910142DPCS2CS212345678J4ABCDEFGDPCS0CS1DPY1BC31uFR910K293031PSENALE/PEA/VPVCCR110R2010R3010R4010R5010R60100R7100R8100S1S2S3S4S5S6S7S8S9S10S11player1player2player3player4player5player6player7player8startime1time2+5v+5VS12Q1enterR101KU0K932R9100BUZZER - 18
20GND12345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7
(2)程序清单
#include
#define uchar unsigned char #define uint unsigned int sbit k1=P1^7;
unsigned char code
disp_code[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0x00,0x40};
uchar biaozhi,xuanshou,s,z,z1,tiaoshi,bianliang1,bianliang2; signed char time[]={0,0};
void delay(uint x) //延时函数
{
uint i,j;
for(i=x;i>0;i--) for(j=125;j>0;j--); }
void xianshi() //显示函数 {
P3_6=1; P3_0=0; P3_7=1;
P0=disp_code[xuanshou]; delay(5);
if(xuanshou!=10) {
P3_0=1; P3_6=0; P3_7=1;
P0=disp_code[time[0]/10]; delay(5); P3_0=1; P3_6=1; P3_7=0;
P0=disp_code[time[0]]; delay(5); }
if(tiaoshi==1) {
- 19
P3_0=1; P3_6=0; P3_7=1;
P0=disp_code[time[1]/10]; delay(5); P3_0=1; P3_6=1; P3_7=0;
P0=disp_code[time[1]]; delay(5); }
P3_0=1; P3_6=1; P3_7=1; }
void anjian() //按键的识别和代码的输出 {
if(biaozhi==1) {
if(P2!=0xff) {
if(P2_0==0) {
xuanshou=1; }
if(P2_1==0) {
xuanshou=2; }
if(P2_2==0) {
xuanshou=3; }
if(P2_3==0) {
xuanshou=4; }
if(P2_4==0) {
xuanshou=5; }
- 20
if(P2_5==0) {
xuanshou=6; }
if(P2_6==0)
{
xuanshou=7; }
if(P2_7==0) {
xuanshou=8; } s=0;
time[0]=bianliang2; biaozhi=2; } }
if(biaozhi==0) {
if(P2!=0xff) {
TR1=1; } } }
void int1(void) interrupt 3 {
k1=0;
TH0=(65536-50000)/256; TL0=(65536-50000)%6; z++;
if(z==5) { z=0; z1++; k1=~k1; }
if(z1==3) {
k1=1; z1=0;
//蜂鸣器驱动函数的设计
- 21
TR1=0;
biaozhi=0; xuanshou=10; } }
void int4(void) interrupt 0 {
biaozhi=3; tiaoshi=0; xuanshou=12; time[0]++;
bianliang1=time[0]; }
void int5(void) interrupt 2 {
tiaoshi=1; biaozhi=3; xuanshou=10; time[1]++;
bianliang2=time[1]; }
void int0(void) interrupt 1 {
TH0=(65536-50000)/256; TL0=(65536-50000)%6; s++;
if(s==20) { s=0;
time[0]--; }
if(time[0]==0) {
time[0]=0; TR0=0; TR1=1; }}
void main()//主函数 {
//调节抢答时间函数
//调节做题时间函数
//中断递增
- 22
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库八路抢答器毕业论文(5)在线全文阅读。
相关推荐: