找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1504|回复: 0
打印 上一主题 下一主题
收起左侧

stm32f4拓展程序乒乓球实验(程序+代码)

[复制链接]
跳转到指定楼层
楼主
ID:488078 发表于 2019-5-13 17:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表