Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/12/06 03:20
Read: times


 
#122110 - I2C interface with 89LPC9221
Responding to: ???'s previous message
Hi Erik,

I agree with you. I'm not copying any code here. Just to understand how i2c is functioning through some code example.

I am writing my own i2c routine to interface with 24C64A. But it seems that when i issue a START condition, my SDA pin and SCL pin always low. I have developed one with 89C61X2 which use port pin to generate SCL and SDA waveform and is working.

However when i switch to 89LPC9221, which comes with i2c facilities with clk rate of 400kHz, my program is not running.

Just to clarify with you whether it works like that:

In order to generate a START condition,
I2CON = 0b01000001;//use timer 1 as SCL clkrate, I2EN = 1
I2CON = I2CON | 0b00100000;//STA = 1
wait there until I2C interrupt generated (SI=1)
in I2C interrupt, monitor value of I2STAT, perform action as stated in datasheet. Clear SI and RETI.

This my understandings on the i2c of 89LPC9221. Am i correct?
Why is it when the program runs, the SCL and SDA pin always low? Note that i have pull-high both pins with resistor 10K to 3.3V. The pins are configured as push-pull. When i stop running i2c routine, the pins go high again.

Please help.

Regards,
Ivan









List of 31 messages in thread
TopicAuthorDate
FAQ: P89LPC9221            01/01/70 00:00      
   Code Architect            01/01/70 00:00      
   that\'s impossible            01/01/70 00:00      
      pin toggle            01/01/70 00:00      
         Sure, but that does not achieve 3.xx MHz            01/01/70 00:00      
            interrupt            01/01/70 00:00      
               that will not do it as I did show in my post            01/01/70 00:00      
                  mode 2            01/01/70 00:00      
                     slovakian math ?            01/01/70 00:00      
                  usermanual of 89LPC9xx insufficient            01/01/70 00:00      
                     please read the WHOLE thread            01/01/70 00:00      
                        Can timer mode 2 overcome interrupt overhead?            01/01/70 00:00      
                           with mode 2 the reload is automatic as \"the            01/01/70 00:00      
                     did you not read            01/01/70 00:00      
   Re: 50kHz output...            01/01/70 00:00      
   I eneterd a FAQ on this            01/01/70 00:00      
      Where? I can't see it            01/01/70 00:00      
         here            01/01/70 00:00      
            I think you misplaced it...            01/01/70 00:00      
               I placed the FAQ correctly but - shame on me - pl            01/01/70 00:00      
                  What is the fastest frequency of Timer Mode 2            01/01/70 00:00      
                     fastest output            01/01/70 00:00      
                        Couldn't Wait in Endless Loop            01/01/70 00:00      
                           NOOOOOOOOO            01/01/70 00:00      
                              Where should i CPL p0.5 then?            01/01/70 00:00      
                                 oooh, then it's impossible, of course            01/01/70 00:00      
                                    89LPC9221 i2c interface            01/01/70 00:00      
                                       I am against "sharing code" but it is there            01/01/70 00:00      
                                          I2C interface with 89LPC9221            01/01/70 00:00      
                                             what does CodeArchitect do ?            01/01/70 00:00      
                                             push-pull?            01/01/70 00:00      

Back to Subject List