usart_init(UART5, 4800, USART_DATA_8BITS, USART_STOP_1_5_BIT);
usart_parity_selection_config(UART5,USART_PARITY_NONE);
usart_hardware_flow_control_set (UART5, USART_HARDWARE_FLOW_NONE);
usart_transmitter_enable(UART5, TRUE);
usart_receiver_enable(UART5, TRUE);
void usart5_send(uint8_t *ptemp, uint16_t len) //发送函数
{
for(u16 i=0; i<len; i++)
{
while(usart_flag_get(UART5, USART_TDBE_FLAG) == RESET);
usart_data_transmit(UART5,*ptemp++);
while(usart_flag_get(UART5, USART_TDC_FLAG) == RESET);
}
}
和BL0939计量芯片通信,这个停止位设置成1.5或0.5就卡死在发生函数里面,设置成1和2可以发送,但是BL0939需要的是4800bps,N,8,1.5 |