Thanx seadolphine200, but the problem stands still,
these are the problem that i encounterd,
first call the i2c write seq,
and read it drom the i2c eeprom(24C256) and display it over the LCD(But here i use portB direct out)
but insted of eeprom content, it outs the location address it self
int data;
char disp[10];
void main(){
LCD_init(&PORTD);
lcd_cmd(LCD_CURSOR_OFF);
lcd_cmd(LCD_CLEAR);
lcd_out(1,1,"TEST I2C");
PORTB = 0x00;
TRISB = 0;
I2C_Init(100000);
Delay_ms(20);
I2C_Start(); // Issue I2C start signal
Delay_ms(20);
I2C_Wr(0xA2);
I2C_Wr(0); // Send byte via I2C (command to 24cO2)
Delay_ms(20);
I2C_Wr(2); // Send byte (address of EEPROM location)
Delay_ms(20);
I2C_Wr(0xF0); // Send data (data to be written)
I2C_Stop();
Delay_ms(100);
I2C_Start(); // Issue I2C start signal
Delay_ms(20);
I2C_Wr(0xA2); // Send byte via I2C (device address + W)
Delay_ms(20);
I2C_Wr(0);
I2C_Wr(2); // Send byte (data address)
I2C_Repeated_Start(); // Issue I2C signal repeated start
I2C_Wr(0xA3); // Send byte (device address + R)
data = I2C_Rd(0u); // Read the data (NO acknowledge)
I2C_Stop();
Delay_ms(200);
WordToStr(data,disp) ;
Lcd_out(2,1,disp);
delay_ms(2000);
}
this is the screenshot frm proteus isis
---------- Post added at 13:01 ---------- Previous post was at 11:18 ----------
Thanx **** the problem was solved myself.. its due to the pullaup resistor