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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/30/06 20:50
Read: times


 
#128796 - What about this
Responding to: ???'s previous message
Erik what do I need here as an address? Is it the slave address? Also I if shit I2ADR = address <<1; //wouldn't it shift/change the address value?
I2ADR = 0x00; // configure I2C address
I2ADR = address << 1;

What about the general call bit? What is that mean. I am going through the p89v66x datasheet in the mean time.

Thanks

/***********************************************************************
DESC:    initializes the I2C peripheral and interrupt
         sets the device's I2C address and whether it will
         respond to the general call address
         Uses a data rate of 32.0565kHz
RETURNS: Nothing
************************************************************************/
void i2c_init(unsigned char address,  bit generalcall) 
					// The 7-bit I2C address to use
          			// 1 = respond to general call, 0 = ignore
                   	// general call
 {
  P1M1 |= 0x0C;	 	// set pins to open-drain
  P1M2 |= 0x0C;

  I2ADR = 0x00;		// configure I2C address
  I2ADR = address << 1;
  if (generalcall)
  {
    I2ADR |= 0x01;
  } // if

  I2SCLH = 0x13;	// configure internal SCL generator
  I2SCLL = 0x12;	// 99.6351kHz

  I2CON = 0x44;		// configure I2C interface
  					// use internal SCL generator

  IP1 &= ~0x01;		// set interrupt priority to 0
  IP1H &= ~0x01;

  mi2cstatus = I2C_IDLE; 	// initial status
  EI2C = 1;	 				// enable interrupt
} 


List of 28 messages in thread
TopicAuthorDate
P89LPC936 I2C            01/01/70 00:00      
   use CodwArchitect            01/01/70 00:00      
   I did            01/01/70 00:00      
      no, I do not do 'time'            01/01/70 00:00      
         It's me            01/01/70 00:00      
   Erik I need help            01/01/70 00:00      
      what about AA?            01/01/70 00:00      
      Here!            01/01/70 00:00      
         read the p89v66x datasheet and go through            01/01/70 00:00      
   What about this            01/01/70 00:00      
      the address issue ...            01/01/70 00:00      
   Don't shift            01/01/70 00:00      
      In other words if a slave uC (or some other            01/01/70 00:00      
   SI != 0            01/01/70 00:00      
      I do not handle bits, I write the SFR in one go            01/01/70 00:00      
         What is that?            01/01/70 00:00      
            sorry, SILABS SFR doing exactly the same            01/01/70 00:00      
               I tried            01/01/70 00:00      
                  are you using a bondout?            01/01/70 00:00      
                     Yes            01/01/70 00:00      
                        try it the old fashioned way            01/01/70 00:00      
                           OK            01/01/70 00:00      
                              is this easier to understand?            01/01/70 00:00      
                                 It Cleared            01/01/70 00:00      
                                    send an e-mail            01/01/70 00:00      
   OK            01/01/70 00:00      
   License Expired            01/01/70 00:00      
      let your friendly local NXP contact know            01/01/70 00:00      

Back to Subject List