【文章內(nèi)容簡(jiǎn)介】
] 李華等.MCS51單片機(jī)實(shí)用接口技術(shù)[M].北京航空航天大學(xué)出版社.[15] 、電容、.[16] :人民郵電出版社,2002.[17] [M].西安:西安電子科技大學(xué)出版社,1997.Number of electronic toys designed touchPhysics and Electronic Engineering HU Yangyang 10310283[Abstract] The number of electronic toys designed for touch digital electronic technology as the foundation, at89c51 microcontroller as the core, bined with digital control, voice chips produced form. Two digital tube display one minute timer, chronograph speech after playback ends。 three a digital tube running at different rates, and use two buttons control the digital control and stop running when the same data is displayed three produce successful voice, whereas failure playback voice. One minute time period, if no success can be repeated for the game, if successful, or time to stop the game is over. Text focuses on the design principles and explain the process in detail and description.[Key words] touch number MCU 附一: 源程序includeinclude define byte unsigned char define word unsigned intsbit dula=P2^7。sbit wela=P2^6。sbit key1=P2^0。sbit key2=P2^1。sbit music1=P2^3。sbit music2=P2^4。sbit music3=P2^5。//*****************************************************************//byte code led[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}。 byte code addr[6]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf}。 word systemtime=0。 //系統(tǒng)時(shí)間byte num_0=0,num_1=0,num_2=0。 //游戲數(shù)字1,2,3char game_time=60。 //游戲時(shí)間byte start_flg=0。 //開(kāi)始標(biāo)志 0暫停;1開(kāi)始byte stop_flg=0。 //停止標(biāo)志byte time_flg=0。 //時(shí)間標(biāo)志byte win_flg=0。 //成功標(biāo)志byte fail_flg=0。 //失敗標(biāo)志//*****************************************************************// void delay(word t)。 //延時(shí) void init_sys(void)。 //定時(shí)器初始化 void display(byte num ,byte wei)。 //數(shù)碼管位顯示 void keyscan(void)。 //按鍵掃描 void led_show(void)。 //數(shù)碼管顯示//****************************延時(shí)*********************************//void delay(word t){ while(t)。}//*************************初始化計(jì)數(shù)器****************************//void init_sys(void){ TMOD=0x01。 TH0=(6553610000)/256。 //10ms TL0=(6553610000)%256。 //10ms EA=1。 ET0=1。 TR0=1。}//***************************主函數(shù)********************************//void main(void){ init_sys()。 music1=0。 music2=0。 music3=0。 while(1) { keyscan()。 led_show()。 if(!game_time) //游戲時(shí)間為0 { fail_flg=1。 time_flg=0。 music3=1。 music1=0。 music2=0。 } } }//*****************************************************************