# (HELP) HOW TO SEND DATA USING I2C TO EEPROM

**URL:** <https://community.sparkfun.com/t/help-how-to-send-data-using-i2c-to-eeprom/2732>\
**Category:** MicroMod\
**Tags:** msp\
**Created:** [September 20, 2006, 7:41am UTC](https://community.sparkfun.com/t/help-how-to-send-data-using-i2c-to-eeprom/2732 "2006-09-20T07:41:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALBERT](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@ALBERT](https://community.sparkfun.com/u/ALBERT)\
**Post date:** [September 20, 2006, 7:41am UTC](https://community.sparkfun.com/t/help-how-to-send-data-using-i2c-to-eeprom/2732/1 "2006-09-20T07:41:58Z")

</div>

I’m using MSP430F169 microcontroller… and i want to send a data(character) to eeprom… where must i send the data to? is it I2CDRB?

Please help me… hank you sooo much

This is my code:

#include \<msp430x16x.h\>

;------------------------------------------------------------------------------

ORG 01100h ; Progam Start

;------------------------------------------------------------------------------

mov.w #0A00h,SP ; Initialize stackpointer

mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT

bis.b #0Ah,&P3SEL ; Select I2C pins

bic.b #I2CEN,&U0CTL ; Recommended init procedure

bis.b #I2C+SYNC,&U0CTL ; Recommended init procedure

bis.b #I2CSSEL\_2,&I2CTCTL ; SMCLK

mov.b #01h,&I2CNDAT ; Read one byte

mov #0048h,&I2CSA ; Slave Address is 048h

bis.b #TXRDYIE,&I2CIE ; Enable RXRDYIE

bis.b #I2CEN,&U0CTL ; Enable I2C

Mainloop bis.b #MST,&U0CTL ; Master mode

bis.b #I2CSTT+I2CSTP+I2CTRX,&I2CTCTL ; Initiate transfer

bis.b #LPM0+GIE,SR ; Enter LPM0, enable interrupts

jmp Mainloop ; Repeat

;------------------------------------------------------------------------------

I2C\_ISR; Common ISR for I2C Module

;------------------------------------------------------------------------------

add &I2CIV,PC ; Add I2C offset vector

reti ; No Interrupt

reti ; Arbitration lost

reti ; No Acknowledge

reti ; Own Address

reti ; Register Access Ready

reti ; Receive Ready

jmp TXRDY\_ISR ; Transmit Ready

reti ; General Call

reti ; Start Condition

TXRDY\_ISR mov.b #05Ah,&I2CDRB ; Load I2CDRB

tstBUSY bit.b #I2CBUSY,&I2CDCTL

jnz tstBUSY

bic #LPM0,0(SP) ; Clear LPM0

reti

;------------------------------------------------------------------------------

; Interrupt Vectors

;------------------------------------------------------------------------------

ORG 0FFFEh ; MSP430 RESET vector

DW RESET ;

ORG 0FFF0h ; I2C interrupt vector

DW I2C\_ISR ;

END

---

<div class="post-metadata">

**Author:** ![ALBERT](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@ALBERT](https://community.sparkfun.com/u/ALBERT)\
**Post date:** [September 20, 2006, 8:20am UTC](https://community.sparkfun.com/t/help-how-to-send-data-using-i2c-to-eeprom/2732/2 "2006-09-20T08:20:57Z")

</div>

The problem is that my MSP board(pin 3.1 and 3.3, SDA and SCL) is connected to eeprom and the eeprom is connected to power suply(for eeprom 1.8-3.0V) and when i turn it on(the power supply), bis.b #I2CSTT+I2CSTP+I2CTRX,&I2CTCTL will only turn I2CTRX high, but the I2CSTT and I2CSTP will still be low… On the other hand, if i turn the power supply off, bis.b #I2CSTT+I2CSTP+I2CTRX,&I2CTCTL will turn the I2CSTT, I2CSTP AND I2CTRX HIGH… to send a data in master mode i gotta set I2CSTT at the first hand right?? anyone know why is this so???
