以下是我的主机程序代码,但是怎么都发不出去数据,SCL和SDA也始终没有拉高,如果哪位前辈懂得,请指点!!!
SysCtlClockSet(SYSCTL_SYSDIV_4_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
IntEnable(INT_I2C0);
I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(), false);
I2CMasterSlaveAddrSet(I2C0_MASTER_BASE, SLAVE_ADDRESS, false);
I2CMasterIntEnable(I2C0_MASTER_BASE);
I2CMasterEnable(I2C0_MASTER_BASE);
while( true )
{
ulDataTx = "I";
I2CMasterDataPut(I2C0_MASTER_BASE, ulDataTx);
I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_SINGLE_SEND);
g_ulI2CError = I2CMasterErr( I2C0_MASTER_BASE );
while( true == I2CMasterBusy( I2C0_MASTER_BASE ) )
{
}
} |