SY/USER/main.c
2020-05-09 01:56:50 +08:00

47 lines
1.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
******************************************************************************
* 内容:SY1
* 作者:zhangsan
* 版本:v1.0
* 日期:2020.04
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "Delay.h"
#include "Tim.h"
#include "Led.h"
#include "Key.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
int main(void)
{
u16 led0pwmval=0;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
LED_GPIO_INIT();
KEY_INIT();
TIM2_INIT(499,7199);
TIM3_PWM_INIT(9,499);
while (1)
{
delay(100000);
led0pwmval+=1;
if(led0pwmval>9)led0pwmval=0;
TIM_SetCompare2(TIM3,led0pwmval);
}
}
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/