Content originally posted in LPCWare by thinkchip on Sat Apr 10 23:18:01 MST 2010 Hi, i trying to read the temperature sensor max6634, the way to read this sensor is send start i2c condition 0xD0 //address write 0x00 // register to try to read restart i2c condition 0xD1 //reading the bytes stop condition
now, I really dont know how to send only the restart condition with no stop condition like in the function I2CEngine();
this is the function that i wrote
void delay_clean (void){
uint32_t i;
for ( i = 0; i < 0x200000; i++ ); /* Delay after write */
for ( i = 0; i < BUFSIZE; i++ ) // zero buffers
{
I2CMasterBuffer = 0x00;
I2CSlaveBuffer = 0x00;
}
}
void read_rtc_ds1388(void){
delay_clean();//delay and clean buffer
I2CWriteLength= 2;
I2CReadLength= 0;
I2CMasterBuffer[0] = DS1388_RTC_ADDR_W; //0xD1
I2CMasterBuffer[1] = 0x00; /* address location to write*/
I2CStart();
delay_clean();
I2CWriteLength= 1;
I2CReadLength= 9;
I2CMasterBuffer[2] = DS1388_RTC_ADDR_R;//0xD1
I2CEngine();
}
our maybe works with
void read_rtc_ds1388(void){
delay_clean();//delay and clean buffer
I2CWriteLength= 2;
I2CReadLength= 0;
I2CMasterBuffer[0] = DS1388_RTC_ADDR_W; //0xD1
I2CMasterBuffer[1] = 0x00; /* address location to write*/
I2CEngine(); //I dont really sure if send start and stop our only the start condition
delay_clean();
I2CWriteLength= 1;
I2CReadLength= 9;
I2CMasterBuffer[2] = DS1388_RTC_ADDR_R;//0xD1
I2CEngine();
}