sudheepsrc
Junior Member level 3
sir,
the code is not working with this HW in proteus and can't see the data 0x10h why???
void main()
{
for(;
{
TRISB=0; // set PORTB to be input
I2C_Init(100000);
I2C_Start();
I2C_Wr(0xA2);
I2C_Wr(0x04);
I2C_Wr(0x10);
I2C_Stop();
Delay_ms(10);
I2C_Start(); // Issue I2C start signal
I2C_Wr(0xA2); // Send byte via I2C (device address + W)
I2C_Wr(0x04); // Send byte (data address)
I2C_Repeated_Start(); // Issue I2C signal repeated start
I2C_Wr(0xA3); // Send byte (device address + R)
PORTB = I2C_Rd(0); // Read the data (NO acknowledge)
I2C_Stop();
delay_ms(100);
PORTB=0;
} }
the code is not working with this HW in proteus and can't see the data 0x10h why???
void main()
{
for(;
{
TRISB=0; // set PORTB to be input
I2C_Init(100000);
I2C_Start();
I2C_Wr(0xA2);
I2C_Wr(0x04);
I2C_Wr(0x10);
I2C_Stop();
Delay_ms(10);
I2C_Start(); // Issue I2C start signal
I2C_Wr(0xA2); // Send byte via I2C (device address + W)
I2C_Wr(0x04); // Send byte (data address)
I2C_Repeated_Start(); // Issue I2C signal repeated start
I2C_Wr(0xA3); // Send byte (device address + R)
PORTB = I2C_Rd(0); // Read the data (NO acknowledge)
I2C_Stop();
delay_ms(100);
PORTB=0;
} }