新手上路
- 积分
- 26
- 金钱
- 26
- 注册时间
- 2020-4-27
- 在线时间
- 7 小时
|
1金钱
u8 tx = 0xaabb>>8;
while( 1 )
{
#if 0
IWDG_ReloadCounter();
LedBatteryIndicator();
Check_System();
System_Control();
STMFLASH_Read(0X08004000,(u16*)datatemp,1);
if(datatemp[0] != ( (Flag_2S << 3)|( FLAG_TIME << 2 ) | ( FLAG_SAFTY << 1 ) | Flag_Retract ))
{
SystemState_Write();
}
UART_send_byte(2);
// UART_send_byte(tx);
UART_send_byte(0xaabb&0xff);
#endif
UART_send_byte(0xaabb&0xff);
}
问题描述:这样串口可以正常发送数据,发出数据aa
u8 tx = 0xaabb>>8;
while( 1 )
{
#if 1
IWDG_ReloadCounter();
LedBatteryIndicator();
Check_System();
System_Control();
STMFLASH_Read(0X08004000,(u16*)datatemp,1);
if(datatemp[0] != ( (Flag_2S << 3)|( FLAG_TIME << 2 ) | ( FLAG_SAFTY << 1 ) | Flag_Retract ))
{
SystemState_Write();
}
UART_send_byte(0xaabb&0xff);
#endif
// UART_send_byte(0xaabb&0xff);
}
问题描述:串口发送放到这边发出的就是错的,只是简单的取了个八位。
u8 tx = 0xaabb>>8;
while( 1 )
{
#if 0
IWDG_ReloadCounter();
LedBatteryIndicator();
Check_System();
System_Control();
STMFLASH_Read(0X08004000,(u16*)datatemp,1);
if(datatemp[0] != ( (Flag_2S << 3)|( FLAG_TIME << 2 ) | ( FLAG_SAFTY << 1 ) | Flag_Retract ))
{
SystemState_Write();
}
UART_send_byte(2);
UART_send_byte(tx);
// UART_send_byte(0xaabb&0xff);
#endif
//UART_send_byte(0xaabb&0xff);
}
问题描述:取八位赋值给一个变量再来发,又正常。
问题:为什么直接取八位放到主程序里发送是有问题的,直接在飞思卡尔的单片机上这样都是ok的,用的iar编译器,目前是keil
|
|