hi every one i am using ccs complier how to set trise resister for scl and sda pins . if it is input we will give 1 and 0 for out put. for the scl pin i can set 0 because it is output and for sda pin it is bidirectional what value 1 are 0 i must give?
Depends on your cable capacitance and required speed. The pullup/down resistor is the R in an RC timing circuit. The speed that your signal will transition will depend on R (your resistor) and C (the capacitance of that signal).
Define cable capacitance and choose Reff according to say <10% of bit period.
I believe configuring I2C with use i2c also sets all required registers. SCL is also operated as an open drain output in standard I2C, at least when using the I2C hardware interface.
I2C pullup resistors are required for both SDA and SCL.
What is the MCU that you are using?
Normally, When you are initializing a peripheral, you do not need to set directions of I/O pins that are related to the peripheral.
you need to use external pull-up resistors for I2C. You can not use internal pull-ups.
If I2c protocol is a part of your processor, so no need to set trise. You need to set the frequency of I2C and trise will be taken care by processor itself. But you should need pullups for both SDA and SCLK line.