我用的是ATmage16单片机,现在出现一个问题,当我发送数据的时候,读取状态寄存器时,一直不对。
if((ReadSjaReg(REG_STATUS)&0x08)) {
PORTC&=~0x08; if((ReadSjaReg(REG_STATUS)&0x04)) { *((uchar *)REG_TxBuffer1) = SendBuf[0]; *((uchar *)REG_TxBuffer2) = SendBuf[1]; datalong = SendBuf[1] & 0x0f; if(datalong>0) { *((uchar *)REG_TxBuffer3) = SendBuf[2]; *((uchar *)REG_TxBuffer4) = SendBuf[3]; *((uchar *)REG_TxBuffer5) = SendBuf[4]; *((uchar *)REG_TxBuffer6) = SendBuf[5]; *((uchar *)REG_TxBuffer7) = SendBuf[6]; *((uchar *)REG_TxBuffer8) = SendBuf[7]; *((uchar *)REG_TxBuffer9) = SendBuf[8]; *((uchar *)REG_TxBuffer10) = SendBuf[9]; } WriteSjaReg(REG_COMMAND,0x01); //置位发送请求位 PORTC&=~0x10; } }
就没进入到这个里面来,那应该是状态寄存器出了问题,这个该怎么解决啊。
|