Hi ,
I am currently doing my final year project using PIC16f877A. I am using TPA81 ,a temperature sensor that uses i2c communication.
The i2c code that I am using is supplied by the PICC-Lite 9.5, which configures (PORTC) RC3 and RC4 as SDA and SCL.
The problem that I am facing is when I try to display the results on 3 LEDs using the same port (PORTC, RC7,RC6,RC5), it crashes the i2c communication as well. I know this because I use LCD to display the temperature, all the values become 0 and I have to restart the system.
I think it may be caused by the Read/Modify/Write issue in the PIC as stated on the i2c.h. Then I found this website RMW and solutions for it that describe the problem and how to solve it. I follow it , (using variable to store then change the value of PORTC at only 1 time and using Delay) , but to no avail.
I could change the i2c to use other ports as I need to use usart that uses same port as the i2c. Does it crash when using i2c and usart at the same port? (Like the problem caused when I tried to change to value on PORTC for the LEDs)
Thanks and any help would be much appreciated.
Regards
Jacky
I am currently doing my final year project using PIC16f877A. I am using TPA81 ,a temperature sensor that uses i2c communication.
The i2c code that I am using is supplied by the PICC-Lite 9.5, which configures (PORTC) RC3 and RC4 as SDA and SCL.
The problem that I am facing is when I try to display the results on 3 LEDs using the same port (PORTC, RC7,RC6,RC5), it crashes the i2c communication as well. I know this because I use LCD to display the temperature, all the values become 0 and I have to restart the system.
I think it may be caused by the Read/Modify/Write issue in the PIC as stated on the i2c.h. Then I found this website RMW and solutions for it that describe the problem and how to solve it. I follow it , (using variable to store then change the value of PORTC at only 1 time and using Delay) , but to no avail.
I could change the i2c to use other ports as I need to use usart that uses same port as the i2c. Does it crash when using i2c and usart at the same port? (Like the problem caused when I tried to change to value on PORTC for the LEDs)
Thanks and any help would be much appreciated.
Regards
Jacky