MSP430, I2C, slaa208.zip

Gast #859245
Lesenswert?
• ▲
▼
Zunächst möchte ich nur mal fragen, ob jemand das Anwendungsprogramm
slaa 208.zip, davon speziell in C, erfolgreich angewendet hat.
Ich habe den EEPROM 24LC32A über I2C angeschlossen und musste 
feststellen, dass das Programm bei „ HÄNGT HIER „  stehen bleibt.
Im Einzelschrittbetrieb bleibt I2CBUSY auf 1 stehen.
Falls ich der einzige bin, bei dem das Programm nicht läuft, muss ich 
natürlich weitersuchen.

Wolfgang

void EEPROM_AckPolling(void)
// Description:
//   Acknowledge Polling. The EEPROM will not acknowledge if a write 
cycle is
//   in progress. It can be used to determine when a write cycle is 
completed.
{ unsigned int count;
  while (I2CDCTL&I2CBUSY); // wait until I2C module has finished all 
operations
  P5OUT ^= 0x10;
  count=0;
  U0CTL &= ~I2CEN;       // clear I2CEN bit => necessary to re-configure 
I2C module
  I2CTCTL |= I2CRM;      // transmission is software controlled
  U0CTL |= I2CEN;        // enable I2C module
  I2CIFG = NACKIFG;      // set NACKIFG
  while (NACKIFG & I2CIFG)
  {
    I2CIFG=0x00;            // clear I2C interrupt flags
    U0CTL |= MST;           // define Master Mode
    I2CTCTL |= I2CTRX;      // I2CTRX=1 => Transmit Mode (R/W bit = 0)
    I2CTCTL |= I2CSTT;      // start condition is generated
    while (I2CTCTL&I2CSTT); // wait till I2CSTT bit was cleared
    I2CTCTL |= I2CSTP;      // stop condition is generated after slave 
address was sent
                            //      => I2C communication is started
  while (I2CDCTL&I2CBUSY); // wait till stop bit is reset   HÄNGT HIER
    count=count+1;
    P5OUT ^= 0x10;
  }
  U0CTL &= ~I2CEN;       // clear I2CEN bit => necessary to re-configure 
I2C module
  I2CTCTL &= ~I2CRM;     // transmission is by the I2C module
  U0CTL |= I2CEN;        // enable I2C module

  return;
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren