找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1674|回復(fù): 0
收起左側(cè)

stm32f4拓展程序乒乓球?qū)嶒灒ǔ绦?代碼)

[復(fù)制鏈接]
ID:488078 發(fā)表于 2019-5-13 17:35 | 顯示全部樓層 |閱讀模式
stm32f4拓展程序乒乓球?qū)嶒?br />
單片機源程序如下:
  1. #include "system.h"
  2. #include "SysTick.h"
  3. #include "led.h"
  4. #include "usart.h"
  5. #include "tftlcd.h"
  6. #include "time.h"
  7. #include "key.h"
  8. #include "ball.h"



  9. int main()
  10. {       
  11.         SysTick_Init(168);
  12.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);  //中斷優(yōu)先級分組 分2組
  13.         LED_Init();
  14.         KEY_Init();
  15.         USART1_Init(9600);
  16.         TFTLCD_Init();                        //LCD初始化
  17.        
  18.         LCD_Clear(BLUE);
  19.         LCD_ShowPictureEx(0, 0, 240, 400);
  20.        
  21.         TIM2_Init(100,8399);
  22.         while(button!= KEY_UP) //等待按鍵K_UP按下
  23.         {
  24.                 FRONT_COLOR=RED;
  25.                 LCD_ShowString(20,10,tftlcd_data.width,tftlcd_data.height,16,"Press K_UP key to Enter...");
  26.                 delay_ms(200);
  27.                 LCD_ShowString(20,10,tftlcd_data.width,tftlcd_data.height,16,"                          ");
  28.                 delay_ms(200);
  29.         }
  30.        
  31.         TIM_ITConfig(TIM2,TIM_IT_Update,DISABLE);
  32.         TIM_Cmd(TIM2, DISABLE);  //失能TIMx
  33.         game_init_show();
  34.         TIM3_Init(100,83999);
  35.         TIM4_Init(10,83999);       
  36.         while(1)
  37.         {
  38.                 ball_play();
  39.         }
  40. }
復(fù)制代碼

所有資料51hei提供下載:
乒乓球游戲.zip (642.5 KB, 下載次數(shù): 18)


回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表