kushal nandanwar
Full Member level 3
- Joined
- Jun 9, 2013
- Messages
- 177
- Helped
- 6
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 18
- Activity points
- 1,258
i2c_init();
i2c_start();
i2c_send(0xa0);
i2c_send(0x00);
i2c_send(5);
i2c_stop();
__delay_ms(100);
i2c_start();
i2c_send(0xa0);
i2c_send(0x00);
i2c_restart();
i2c_send(0xa1);
sec = i2c_read();
i2c_stop();
void i2c_init()
{
TRISC3 = 1;
TRISC4 = 1;
SSPSTAT |= 0x80; //Slew Rate Disabled
SSPADD = 0x28;
SSPCON=0x28; //Master mode
}
void i2c_start(void)
{
SEN = 1;
while (SEN == 1)
continue;
}
i2c_start();
i2c_send(0xa0);
i2c_send(0x00);
i2c_send(5);
i2c_stop();
__delay_ms(100);
i2c_start();
i2c_send(0xa0);
i2c_send(0x00);
i2c_restart();
i2c_send(0xa1);
sec = i2c_read();
i2c_stop();
void i2c_init()
{
TRISC3 = 1;
TRISC4 = 1;
SSPSTAT |= 0x80; //Slew Rate Disabled
SSPADD = 0x28;
SSPCON=0x28; //Master mode
}
void i2c_start(void)
{
SEN = 1;
while (SEN == 1)
continue;
}