基于单片机模拟打地鼠游戏设计-protues仿真毕业

资料下载地址-1056(百度网盘):点击下载

基于单片机模拟打地鼠游戏设计-protues仿真毕业基于单片机模拟打地鼠游戏设计-protues仿真毕业

 #include<reg52.h>
#include<stdlib.h>
sbit RS=P2^0;
sbit EN=P2^1;
sbit Speak=P2^2;
sbit button1=P2^3;	    //选择模式键
sbit button2=P2^4;		//确认键、返回键、暂停键、下一关开始键
sbit Buzzer=P2^6;
sbit hole1=P2^7;	//1号洞
sbit SDA=P1^1;		//24c02数据线
sbit SCL=P1^0;		//24c02时钟线
unsigned char Count;	//Play_Song使用
unsigned char i,j;
unsigned char temp;		//随机数种子
unsigned char result;	//随机数临时变量
unsigned char score;	//保存临时分数
unsigned char tempname[2];//保存临时分数的名字
unsigned char time;		//保存时间(30秒倒计时)
unsigned char num;		//1秒钟判断变量
unsigned char flag1;	//1标识得分,led全灭,不进行scankey操作
unsigned char flag2;	//1标识得分Buzzer响方式1
unsigned char flag3;	//1标识地鼠出洞时间到,开始下一轮地鼠出洞
unsigned char flag4;	//1标识关卡时间到
unsigned char flag5;	//1标志暂停
unsigned char level;	//关卡等级
unsigned char holenum;	//保存随机生成的洞号
unsigned char topscore[3]={0}; //保存3个最高分
unsigned char name[3][2]={"AA","BB","CC"};  //保存3个最高分名字	   
unsigned char code hole[]={0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};//P3口控制的洞	
unsigned char code str1[]={"Welcome!"};				//欢迎标语
unsigned char code str2[]={"1.start 2.score"}; 
unsigned char code str3[]={"3.exit"};				
unsigned char code str4[]={"See You! "};				//exit界面
unsigned char code str5[]={"Ready?"};
unsigned char code str6[]={"GO!"};
unsigned char code str7[]={"Your Soccer: "};			//查看分数
unsigned char code str8[]={"Time:   Score:  "};
unsigned char code str9[]={" Team: SONGE "};			//队名
unsigned char code str10[]={"Game Over!"};	
unsigned char code str11[]={"You Win! GO?"};	
unsigned char code str12[]={"You Lose!"};
unsigned char code str13[]={"top1:"};
unsigned char code str14[]={"Congratulations"};
unsigned char code str15[]={"hole:   level:"};
unsigned char code str16[]={"top2:"};
unsigned char code str17[]={"top3:"};
unsigned char code str18[]={"Your Name:"};			//记录姓名
基于单片机模拟打地鼠游戏设计-protues仿真毕业

基于单片机模拟打地鼠游戏设计-protues仿真毕业基于单片机模拟打地鼠游戏设计-protues仿真毕业

上一篇:AD转换及单片机通信


下一篇:单片机-模数AD转换-TLC549芯片