我在发送 const BYTE SetDisrtibutorAttitudeAddr=0x12; const char SetHDFormatAddr=0x15;
void I2Cm_SendCommand(char CommandAddr,char CommandByte) { char DataBuffer[2]; DataBuffer[0]=CommandAddr; DataBuffer[1]=CommandByte; // Send the contents of the data in txBuffer I2CHW_bWriteBytes(SLAVER_ADDRESS, DataBuffer, 2, I2CHW_CompleteXfer); // Wait until the data is transferred
while(!I2CHW_bReadI2CStatus() & I2CHW_WR_COMPLETE);
// Clear Write Complete Status bit I2CHW_ClrWrStatus(); } main函数中: M8C_EnableGInt; /* Start the master */ I2CHW_Start(); I2CHW_EnableMstr(); I2CHW_EnableInt();
I2Cm_SendCommand(SetDisrtibutorAttitudeAddr,0xff); I2Cm_SendCommand(SetHDSleepingAddr,0x0);
的时候,这两条不同的发送语句在slaver和示波器中收到的数据都是: c5和0B, 百思不得其解... |