| ??? 10/10/08 20:36 Read: times |
#158963 - Always get IDLE status in I2C bus Responding to: ???'s previous message |
I put a spy function. I transmmit to serial each status.
#define AT24C256 0x50 // (0101 0000)
#define I2CINIT 0x7F
static unsigned char i2cVector[30];
unsigned int IndexRx;
unsigned int IndexTx;
void main(void)
{
uart_init();
i2c_init(I2CINIT, 0);
EA=1;
uart_transmit(i2c_getstatus());
IndexTx=3; // number of bytes to transmit
i2cVector[0]=0x00; // MSB
i2cVector[1]=0x00; // LSB
i2cVector[2]=0xA5; // data to write
i2c_transmit(AT24C256);
uart_transmit(i2c_getstatus());
while (i2c_getstatus() & I2C_BUSY);
uart_transmit(i2c_getstatus());
i2c_transfer_finished();
uart_transmit(i2c_getstatus());
while(1);
}
I receive 0x00 (IDLE) and 0x03 (I2C_BUSYTX). Only these. Why ? Jorge |



