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.

CCS/MSP430F5529: MSP430F5229, LMX2595

Part Number: MSP430F5529

Tool/software: Code Composer Studio

hello sir,

I am new to this forum and I have few questions related to programming in MSP430F5529 by making use in master mode. In my application i am using this controller to load the register values which i get from TICS PRO software. The values which I obtain are 24-bit long which has 1-bir r/w, 7-bit address, 16-bit data. 

1) How can I define the memory space in the above format?

2) I am facing some difficulties in the code which is attached below

#include <msp430.h>
unsigned long register_values[79]

void IOInitiate(void)
void SPI_master_Initiate(void)

void write_register(unsigned long value)
{
SPI_Tx((value>>16) & 0xFF);
SPI_Tx((value>>8) & 0xFF);
SPI_Tx((value>>0) & 0xFF);
}

/**
* main.c
*/
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
IOInitiate(); // input output initialization
SPI_master_Initiate(); //master initialization
__bis_SR_register(GIE); // enable interrupts
return 0;

}
unsigned long register_values[79] = {0x00251C,0x010808,0x020500,0x030642,0x040A43,0x0500C8,0x06C802,0x0740B2,0x082000,0x091604,0x0A10D8,0x0B0018,0x0C5001,0x0D4000,0x0E1E40,0x0F064F,0x100080,0x11012C,0x120064,0x1327B7,0x14E048,0x150401,0x160001,0x17007C,0x18071A,0x190C2B,0x1A0DB0,0x1B0003,0x1C0488,0x1D318C,0x1E318C,0x1F43EC,0x200393,0x211E21,0x220000,0x230004,0x24002A,0x250404,0x26FFFF,0x27FFFA,0x280000,0x290000,0x2A7FFF,0x2BFFFD,0x2C0AE3,0x2DD0DF,0x2E07FD,0x2F0300,0x300300,0x314180,0x320000,0x330080,0x340820,0x350000,0x360000,0x370000,0x380000,0x390020,0x3A8001,0x3B0001,0x3C0000,0x3D00A8,0x3E0322,0x3F0000,0x401388,0x410000,0x4201F4,0x430000,0x4403E8,0x450000,0x46C350,0x470081,0x480001,0x49003F,0x4A0000,0x4B0800,0x4C000C,0x4D0000,0x4E0003}

for(reg=0; reg<79; reg++)
{
write_register(register_values[reg]);
}

void IOInitiate(void)
{
P2DIR |= BIT7; // Set P2.0 to output
P2OUT &= ~BIT7; //LOW as default
P3SEL |= BIT0+BIT2; // P3.0 UCA0SIMO // p3.2 clk
P2SEL |= BIT7; // CS
}
void SPI_master_Initiate(void)
{
UCB0CTL1 |= UCSWRST; // **Put state machine in reset**
UCB0CTL0 |= UCMST+UCSYNC+UCCKPL; //8-bit SPI master Clock polarity high, MSB
UCB0CTL0 |= UCMODE_2; // 4 pin communication
UCB0CTL1 |= UCSSEL_2; // SMCLK // clock selection
UCB0BR0 = 0x00; // SMCLK speed divide by 1 /*******If UCBRx = 0, fBitClock = fBRCLK****/
UCB0BR1 = 0;

UCA0MCTL = 0; // No modulation
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
//UCB0IE |= UCTXIE; // receving interrupt enable
}
uint8_t spix(uint8_t c)
{
while(!(UCB0IFG & UCTXIFG))
UCTXIFG = c;
while (!(UCB0IFG & UCRXIFG))
c = UCRXIFG;
return(c);
}

sir, I am new to programming and I kindly request you to tell me the necessary changes.

Thanks in advance

**Attention** This is a public forum