各位大侠:
我UART3发送中断进不去,并且寄存器TCE一直是灰色的不能修改和清除,初始化时TXE和TC就直接被置为了,下面是我的配置程序
[mw_shl_code=c,true]void USART3_Configuration(void)
{
USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure;
//????UART3?±??
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE);
USART_InitStructure.USART_BaudRate = 4800;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable;
USART_ClockInit(USART3, &USART_ClockInitStructure);
USART_Init(USART3, &USART_InitStructure);
USART_Cmd(USART3, ENABLE);
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
USART_ClearFlag(USART3, USART_FLAG_TXE);
USART_ClearFlag(USART3, USART_FLAG_TC);
}
[/mw_shl_code]
当执行完
[mw_shl_code=c,true]RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE); 配置时钟是TXE和TC就应经被置为了[/mw_shl_code] |