is there anybody with experiences in I2C S/W-application. I took the example of AN1045 and ported it to my Lite29-project. In fact it works, but there are some questions which I'd like to discuss. Thanks for reply WoRo
great that you replied immediately.:-D Here are my questions: - In the ROUTINE wait_Ack there is an ambiguous sequence (twice the same code): if(ValBit(PADR,SDA)) /* Test of SDA level, if high -> pb */
...
delay(2);
if(ValBit(PADR,SDA)) ....
...
delay(5);
1st: What's the sense? 2nd: What means ''-> pb'' 3rd: Does your application work while you leave the code? I must skip it!!! - In the ROUTINE I2C_nAck the line ClrBit(PADR,SDA); /* The master pulls the SDA line high */the code or the comment seem not to be correct. Any suggestion? - To avoid spurious changes of the output register values while using bclr or bset commands with PADR, I'd like to fix the output values before changing a port to output: ClrBit(PADR,SCL); SetBit(PADDR,SCL);Or better: disableInterruptMask; ClrBit(PADR,SCL); SetBit(PADDR,SCL); enableInterruptMask;Any experiences? Sorry Henry, I have no idea to your problem with the odd numbers.:-[ - Did anybody else find further ambiguities or problems with the given code or has tuned it for better performance?? Thanks in advance WoRo