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