This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C transferring character

Other Parts Discussed in Thread: MSP430F5438A

Hello. I am using msp4305438A. The FET debugger is msp430-UIF. I want to transfer "HELLO" to a slave using I2C. My code is as follows. I am getting an error message that

Error:expected a declaration

Error while running C/C++ compiler.

#include"msp430.h"

{

  WDTCTL = WDTPW + WDTHOLD;

  UCB0CTL0 = UCA10_0 + UCSLA10_0 + UCMM_0 + UCMST_1 + UCMODE_3 + UCSYNC_1;

  UCB0CTL1 = UCSSEL_2 + UCTR_1 + UCT0STT + UCSWRST;

  unsigned char x[5]={0x48,0x45,0x4C,0x4C,0x4F};

  char *ptr;

  ptr = &x;

  UCB0TXBUF = *ptr;

  ptr++;

  UCB0CTL1 = UCT0STP;

  _EINT();

  _BIS_SR(LPM0_bits);

  while(1);

}

 

**Attention** This is a public forum