|
#pragma vector=UART0RX_VECTOR
__interrupt void usart0_rx (void)
{
int print_data,temp0,temp1,temp2,temp3,temp4,temp5;
clear_wdt();
rx_temp = RXBUF0;
TXBUF0 = RXBUF0;
snd[uart_temp] = rx_temp;
uart_temp++;
if(uart_temp > 3)
{
temp0 = (snd[0] & 0x0f) ;
temp0 = temp0 << 4 ;
temp1 = (snd[1] & 0x0f);
temp2 = (snd[2] & 0x0f);
temp2 = temp2 << 4 ;
temp3 = (snd[3] & 0x0f);
temp4 = temp0|temp1;
temp5 = temp2|temp3;
}
while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready?
}
大家遇到过样的问题吗?编译器可耻地优化了以下的代码,我用IAR3.42中等优化,加了VOLATILE就可以了,
if(uart_temp > 3)
{
temp0 = (snd[0] & 0x0f) ;
temp0 = temp0 << 4 ;
temp1 = (snd[1] & 0x0f);
temp2 = (snd[2] & 0x0f);
temp2 = temp2 << 4 ;
temp3 = (snd[3] & 0x0f);
temp4 = temp0|temp1;
temp5 = temp2|temp3;
}
|
|