I have MSP430f47197 + an EEPROM (24C02CSN) which are connected to each other through I2C protocol.
I have my SDA connected to UCB1SDA and SCL is connected to UCB1SCL of MCU.
I think the following code that I partially got it from the example codes sends those characters towards the EEPROM but how I can get those back from EEPROM and show them on the display?
#include "msp430f47197.h"
unsigned char *PTxData; // Pointer to TX data
volatile unsigned char TXByteCtr;
volatile unsigned char RXByteCtr;
const unsigned char TxData[] = // Table of data to transmit
{
0x21,
0x22,
0x23,
0x24,
0x25
};
int main( void )
{
volatile unsigned int i;
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
FLL_CTL0 |= XCAP11PF; // Configure load caps
// Wait for xtal to stabilize
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 0x47FF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?
P5SEL =BIT1+BIT2+BIT3+BIT4; // Set COM pins for LCD
LCDACTL = LCDON+LCD4MUX; // 4mux LCD, ACLK/32
LCDAPCTL0 = 0x7F; // Segments 0-24
for( i = 0; i <= 20; i ++)
{
LCDMEM[i] = 0; // Clear LCD We have 20 LCDMemory
}
P2SEL |= BIT1+BIT2; // Assign I2C pins to USCI_B1
UCB1CTL1 |= UCSWRST; // Enable SW reset
UCB1CTL1 = UCMODE_3 + UCSYNC; // I2C Slave, synchronous mode
UCB1I2COA = 0x017C; // Own Address is 0x017C
UCB1CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
UCB1I2CIE |= UCSTPIE + UCSTTIE; // Enable STT and STP interrupt
IE2 |= UCB1TXIE; // Enable TX interrupt
while (1)
{
PTxData = (unsigned char *)TxData; // Start of TX buffer
TXByteCtr = 0; // Clear TX byte count
UCB1TXBUF = *PTxData++;
TXByteCtr++;
// RXByteCtr = 0;
// LCDMEM[2] = UCB1RXBUF;
// RXByteCtr++;
// __delay_cycles(1000000);
} // read out the TXByteCtr counter
}






