hi
i guess i am a little fresher in i2C i am trying to write and read data form the 24LC64 serial eeprom using msp430f2274 USIC module for the start condition i am able to get the ACK but after that i am trying to send the MSB of the address as per the datasheet of the eeprom i am not getting the ACK signal.
The main problem seems to be that i am unable to generate the 9th clock pulse that is required for the slave device to generate an ACk . pls correct the code i need to write only 10 bytes of data and i need to read it back
#include "msp430F2274.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x01; // P1.0 output
P3SEL |= 0x06; // Assign I2C pins to USCI_B0
UCB0CTL1 |= UCSWRST; // Enable SW reset
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
UCB0BR0 = 12; // fSCL = SMCLK/12 = ~100kHz
UCB0BR1 = 0;
UCB0I2CSA = 0x50; // Set slave address
UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
// IE2 |= UCB0TXIE; // Enable RX interrupt
{
UCB0CTL1 |= UCTR + UCTXSTT; // I2C Start Condition in master transmitter mode
while (UCTXSTT==1); // For reading the specified register
UCB0TXBUF = 0x00;
while (UCTXSTT==1);
UCB0TXBUF = 0x02;
while (UCTXSTT==1);
UCB0CTL1 &= ~UCTXSTP;
}
}