-
. z.
简述嵌套向量中断控制器(NVh"
#include ""
#include ""
/* Private function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void Init_GPIOs (void);
void Delay(uint32_t nTime);
void USART_Configuration(void);
void E*TI_Configuration(void);
void NVIC_Configuration(void);
static volatile uint32_t TimingDelay;
int main(void)
{ /* Configure Clocks for Application need */
RCC_Configuration();
SysTick_Config(16000000/ 2000);
NVIC_Configuration();
/* Init I/O ports */
Init_GPIOs();
USART_Configuration();
E*TI_Configuration();
// printf("\r\nWelcome !!!\r\n");
while(1)
{ // Delay(20);
// printf("\r\nWelcome !!!\r\n");
}
}
void RCC_Configuration(void)
{ RCC_DeInit();
/* Enable HSI Clock */
RCC_HSICmd(ENABLE);
/*!< Wait till HSI is ready */
while (RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET)
{}
/* RCC_PLLCmd(DISABLE);
RCC_PLLConfig(RCC_PLLSource_HSI,RCC_PLLMul_3,RCC_PLLDiv_2);
RCC_PLLCmd(ENABLE); */
/*!< Wait till PLL is ready */
// while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
// {}
// RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);
RCC_MSIRangeConfig(RCC_MSIRange_6);
RCC_HSEConfig(RCC_HSE_OFF);
-
. z.
if(RCC_GetFlagStatus(RCC_FLAG_HSERDY) != RESET )
{ while(1); }
/* Enable comparator clock LCD and PWR mngt */
//RCC_APB1PeriphClockCmd(RCC_APB1Periph_LCD | RCC_APB1Periph_PWR, ENABLE);
/* Enable ADC clock & SYSCFG */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_SYSCFG | RCC_APB2Periph_USART1 , ENABLE);
}
void Init_GPIOs (void)
{ GPIO_InitTypeDef GPIO_InitStructure;
/* Enable GPIOs clock */
RCC_AHBPeriphClockCmd(LD_GPIO_
stm32期末考试答案详解 来自淘豆网m.daumloan.com转载请标明出处.