本帖最后由 mmuuss586 于 2014-4-15 13:21 编辑
STM32 F107
/*****************************************************************
*****************************************************************/
void USART1_Init(unsigned int baud)
{
USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate = baud;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART1, &USART_InitStructure);
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
USART_Cmd(USART1, ENABLE);
}
void NVIC_Configuration(void)
{
MyNVIC_Init(NVIC_PriorityGroup_2,1,0,USART1_IRQn,ENABLE); //
MyNVIC_Init(NVIC_PriorityGroup_2,2,0,USART2_IRQn,ENABLE);
MyNVIC_Init(NVIC_PriorityGroup_2,2,1,USART3_IRQn,ENABLE);
MyNVIC_Init(NVIC_PriorityGroup_2,2,2,TIM7_IRQn,ENABLE);
MyNVIC_Init(NVIC_PriorityGroup_2,2,3,TIM3_IRQn,ENABLE);
}
void USART1_IRQHandler(void)
{
//int i,b,d1;
//UInt32 d;
if(USART_GetITStatus(USART1 , USART_IT_RXNE) != RESET)
{
}
} |