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 18:53
Read: times


 
#128783 - Erik I need help
Responding to: ???'s previous message
This is what I have so far...


i2c_init(DS1337, 1);  // store slave address, gral call
i2c_transmit(DS1337); // transmit slave address
i2c_getstatus();      // get status while(SI);
i2c_transmit(0x0E);   // write to register control address

// after the first transmit "i2c_transmit(DS1337);" I get 
    case 0x08:	// Start condition Xmitted
    case 0x10:	// Repeat Start condition Xmitted
      I2DAT = mslaveaddress;
      STA = 0;
      STO = 0;
	  SI = 0;
      mbytenum = 0;
      break;

// then I get this 

// ACK for slave address + W
    case 0x18: 	// SLA + W Transmitted; Ack has been received
    I2DAT = i2c_master_getbyte(mbytenum);// Data transmitted 
    STA = 0;
    STO = 0;
    break;

// then I get this over & over

case 0x40:// Slave address + R transmitted, Ack received
      STA = 0;
      STO = 0;
      if (i2c_master_islastrxbyte(mbytenum))
      {
        AA = 0;	// return NACK for data byte, two more bytes 
      }
      else
      {
        AA = 1;	 // return ACK for data byte
      } // if
      	  break;



How can I clear SI? I try by writing a zero "0" to it, but it does not clear.
Does this interrupt looks like it is going the right way?

Erik what could an code sample for this function?
I2DAT = i2c_master_getbyte(mbytenum);// Data transmitted
/***********************************************************************
DESC:    gets the next byte to be transmitted when operating as
         a master
RETURNS: byte to transmit
************************************************************************/
unsigned char i2c_master_getbyte(unsigned int bytenum)    
			// number of the byte in this transfer
                        // (0 = first byte)
{
  // insert code
  return 0x00;
} 

Be detailed please



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