stm32串口发送程序 单独测试是好使的 但是整合到以前写的程序上去之后就发送不了了 发送程序是一模一样的 我想问一下这是什么原因造成的?(设置应该不会有问题 因为单独测试是好使的)
Tx_Dat[0] = 0x55;
Tx_Dat[1] = 0x55;
Tx_Dat[2] = (unsigned char)(((unsigned short int)(ADUcal30))>>8);
Tx_Dat[3] = (unsigned char)(((unsigned short int)(ADUcal30))&0xff);
Tx_Dat[4] = (unsigned char)(((unsigned short int)(Dac_current*100.0))>>8);
Tx_Dat[5] = (unsigned char)(((unsigned short int)(Dac_current*100.0))&0xff);
Tx_Dat[6] = 0xAA;
Tx_Dat[7] = 0xAA;
delay_ms(100);
usart_send_data(Tx_Dat,8);
void send_data(u8 *data)
{
int leng_temp;
int n;
leng_temp = strlen(data);
for(n = 0;n < leng_temp;n++)
{
USART_SendData(USART1, (unsigned char) data[n]);
while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET){;}
}
}
void usart_send_data(u8 *str,u8 length)
{
int n;
for(n = 0;n < length;n++)
{
USART_SendData(USART1,str[n]);
while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET){;}
}
}
转载
|