stm32f4拓展程序乒乓球实验
单片机源程序如下:
- #include "system.h"
- #include "SysTick.h"
- #include "led.h"
- #include "usart.h"
- #include "tftlcd.h"
- #include "time.h"
- #include "key.h"
- #include "ball.h"
- int main()
- {
- SysTick_Init(168);
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //中断优先级分组 分2组
- LED_Init();
- KEY_Init();
- USART1_Init(9600);
- TFTLCD_Init(); //LCD初始化
-
- LCD_Clear(BLUE);
- LCD_ShowPictureEx(0, 0, 240, 400);
-
- TIM2_Init(100,8399);
- while(button!= KEY_UP) //等待按键K_UP按下
- {
- FRONT_COLOR=RED;
- LCD_ShowString(20,10,tftlcd_data.width,tftlcd_data.height,16,"Press K_UP key to Enter...");
- delay_ms(200);
- LCD_ShowString(20,10,tftlcd_data.width,tftlcd_data.height,16," ");
- delay_ms(200);
- }
-
- TIM_ITConfig(TIM2,TIM_IT_Update,DISABLE);
- TIM_Cmd(TIM2, DISABLE); //失能TIMx
- game_init_show();
- TIM3_Init(100,83999);
- TIM4_Init(10,83999);
- while(1)
- {
- ball_play();
- }
- }
复制代码
所有资料51hei提供下载:
乒乓球游戏.zip
(642.5 KB, 下载次数: 18)
|