applecon2000
Joined: 29 Jul 2007 Posts: 31 Location: UK
|
Need help with i2c slave interface |
Posted: Thu Aug 16, 2007 4:31 pm |
|
|
dear sir,
after RS232 interface, I also need build I2C and SPI interfaces into my LCD module, after reading the datasheet of PIC16F876A and the help file of CCS Compiler, I have been sure about the working principle. My current codes of I2C was shown below:
Code: |
#USE I2C(slave, sda=PIN_C4, scl=PIN_C3, address=0x00)
...
while(1)
{
i2c_start();
while(!i2c_poll()) ;
value3=i2c_read();
lcd_putc(value3);
i2c_stop();
} |
Without the experience in I2C and SPI interface, my hardware did not work with I2C interface in simulating. Could you please check my code and give me several suggestions for those two interfaces?
By the way, my hardware would only be regarded as a slave.
Thanks. _________________ Enjoy our EEE |
|