标题: stm32f4拓展程序乒乓球实验(程序+代码) [打印本页]

作者: 18892336058    时间: 2019-5-13 17:35
标题: stm32f4拓展程序乒乓球实验(程序+代码)
stm32f4拓展程序乒乓球实验

单片机源程序如下:
  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);  //中断优先级分组 分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. }
复制代码

所有资料51hei提供下载:
乒乓球游戏.zip (642.5 KB, 下载次数: 18)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1