Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MSP430 USART / SPI - Problem

Status
Not open for further replies.

Divemen

Junior Member level 1
Junior Member level 1
Joined
Mar 12, 2002
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
86
msp430 usart spi

Hello,

I start programming in "C" with the MSP430 and have the following problem:

Configuration:

- MSP430F149 on Headerboard from Olimex and the JTAG from Olimex.
- IAR Kickstart V1.26A

I have a problem by the use of USART1 in SPI Mode.
I use a 2 x 6 Numerical Display over the SPI of USART 1. (see below)

In run mode, i can only get 4 of 6 Digits on the Display but in single step
all works fine. I tryed to do this at lower speed but it is always the same.

What is wrong?
Can anybody help me?


Thanks Divemen

My Source:

void init_numerical_LCD(void)
{
ME2 |= USPIE1; // Enable USART1 SPI mode
UTCTL1 = CKPH+SSEL1+SSEL0+STC; // SMCLK, 3-pin mode
UCTL1 = CHAR+SYNC+MM; // 8-bit SPI Master **SWRST**
UBR01 = 0x80; // UCLK/128
UBR11 = 0x0; // 0
UMCTL1 = 0x00; // no modulation

P5SEL |= 0x0A; // P5.1-3 SPI option select
P5DIR |= 0x01; // P5.0 output direction
}


void write_Num_Display(void)
{
char x[] = {5,2,3,7,4,8};
signed char y,z;

for (z = 6; z > 0;z--)
{
y = x[z-1];
while ((IFG2 & UTXIFG1) == 0); // USART1 TX buffer ready?
TXBUF1 = Display_Table[y];
}

P5OUT |= 0x01; // Latch data into LCD P5.0 =1
P5OUT &= ~0x01; // P5.0 = 0

}

const char Display_Table[] =
{0x77, // 0 numerical Display output value
0x14, // 1
0xB3, // 2
0xB6, // 3
0xD4, // 4
0xE6, // 5
0xE7, // 6
0x34, // 7
0xF7, // 8
0xF6, // 9
0xF5, // A
0xC7, // B
0x63, // C
0x97, // D
0xE3, // E
0xE1 // F
};
 

msp430 usart1

Hai all,

I have found the problem by myself.

The problem in this routine is the time to latch the data into the display, it was to fast. The SPI-communication was not ready.

The working Code is here:

void write_Num_Display(void)
{
char x[] = {5,2,3,7,4,8};
signed char y,z;

for (z = 6; z > 0;z--)
{
y = x[z-1];
while ((IFG2 & UTXIFG1) == 0); // USART1 TX buffer ready?
TXBUF1 = Display_Table[y];
}

---->>> WAIT Routine here, and it works <<<------

P5OUT |= 0x01; // Latch data into LCD P5.0 =1
P5OUT &= ~0x01; // P5.0 = 0

}


Thanks Divemen

PS: Sorry for the double post
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top