小生SH4做个DD,用串口发送数据,数据放在txBuff[0-16]中,当我这样发送的时候 txBuff[0] = 0x3a; txBuff[1] = 0x07; txBuff[2] = (unsigned char)ReadData[0]; txBuff[3] = (unsigned char)ReadData[1]; txBuff[4] = (unsigned char)ReadData[2]; txBuff[5] = (unsigned char)ReadData[3]; txBuff[6] = (unsigned char)ReadData[4]; txBuff[7] = (unsigned char)ReadData[5]; txBuff[8] = (unsigned char)ReadData[6]; txBuff[9] = (unsigned char)DataBuff2[0]; txBuff[10] = (unsigned char)DataBuff2[1]; txBuff[11] = (unsigned char)DataBuff2[2]; txBuff[12] = (unsigned char)DataBuff2[3]; txBuff[13] = (unsigned char)DataBuff2[4]; txBuff[14] = (unsigned char)DataBuff2[5]; txBuff[15] = (unsigned char)DataBuff2[6]; txBuff[16] = (unsigned char)(txBuff[0] ^ txBuff[1] ^ txBuff[2] ^ txBuff[3] ^ txBuff[4] ^ txBuff[5] ^ txBuff[6] ^ txBuff[7] ^ txBuff[8] ^ txBuff[9] ^ txBuff[10] ^ txBuff[11] ^ txBuff[12] ^ txBuff[13] ^ txBuff[14] ^ txBuff[15]); for(i=0; i< 17; i++) { TERMIO_PutChar((unsigned char)txBuff); } 用串口调试工具接收到的数据居然是txBuff[15] txBuff[16] txBuff[0]....txBuff[14],奇怪的是为什么txBuff[15] txBuff[16],会在最前面,如果for(i=0; i< 17; i++) { TERMIO_PutChar((unsigned char)txBuff); } 后面+个NOP,在这个NOP设置个断点,每次发送又是好的,顺序是对的从txBuff[0]....txBuff[16],那位高手能回答一下吗? 我的串口初始化 void InitUart(void) { /* ### Init_SCI init code */ //Baud rate = BUSCLK / (16 x SBR12:SBR0) /* SCIBD: SBR12=0,SBR11=0,SBR10=0,SBR9=0,SBR8=0,SBR7=0,SBR6=0,SBR5=0,SBR4=1,SBR3=1,SBR2=0,SBR1=1,SBR0=0 */ SCIBD = BUSCLK/16/SciBandRate; // /* SCIC1: LOOPS=0,SCISWAI=0,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */ SCIC1 = 0x00; /* SCIC2: TIE=0,TCIE=0,RIE=0,ILIE=0,TE=1,RE=0,RWU=0,SBK=0 */ SCIC2 = 0x08; } 发送代码 void TERMIO_PutChar(unsigned char send) { volatile unsigned char dummy; while(!SCIS1_TDRE); dummy = SCIS1; SCID = send; }//end SPI_PutChar |