Skip to main content
Visitor II
September 11, 2006
Question

I2C S/W-implementation (AN1045)

  • September 11, 2006
  • 3 replies
  • 834 views
Posted on September 11, 2006 at 08:28

I2C S/W-implementation (AN1045)

    This topic has been closed for replies.

    3 replies

    Visitor II
    September 11, 2006
    Posted on September 11, 2006 at 05:33

    Hi,

    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

    Visitor II
    September 11, 2006
    Posted on September 11, 2006 at 06:26

    Hi Woro,

    The best is to ask your question(s), then may be someone can answer !

    BR

    Laurent

    Visitor II
    September 11, 2006
    Posted on September 11, 2006 at 08:28

    Hi Henry,

    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