msp430f5310 microcontroller

Status
Not open for further replies.

kamalnath

New Member
i had attempted to do serial communication in msp430f5310.I coudnt see the output for it since the program shows no error.Kindly,give solution for this.
C:
#program
#include <stdio.h>

#include<msp430f5310>

/*

* main.c

*/

int main ( void )

{



unsigned int i;

WDTCTL = WDTPW | WDTHOLD; // stop watchdog  timer

P4SEL = BIT4;

P4SEL = BIT5;

UCA1CTL1 = UCSWRST;

UCA1CTL1 = UCSSEL_1;

UCA1BR0=8;

UCA1BR1=0;

UCA1MCTL = UCBRS_0 | UCBRF_13 | UCOS16;

UCA1CTL1 &= ~UCSWRST;

P4DIR = 0XFF;

while

{

UCA1TXBUF = 'a' ;

P4OUT ^= 0XFF;

for(i=0;i<5000;i++)

{



}

}

}
 
Last edited by a moderator:
If you expect help then at least learn how to post (and format) code.

Type [code] before your code and [/code] after. Also, ensure your indenting is correct on your code and add some comments.

Mike.
 
im doing the codes in code composer studio software.So,kindly help me on that serial communicaton in msp430f5310.I coudnt understand how i should make the left arm ambidextrous.
 
Last edited:
I had attempted to do serial communication in msp430f5310.I coudnt see the output for it since the program shows no error. Kindly, give solution for this.
C:
#include <stdio.h>

#include<msp430f5310>

/*

* main.c

*/

int main ( void )

{



unsigned long i;

WDTCTL = WDTPW | WDTHOLD; // stop watchdog  timer

P4SEL = BIT4; //SELECTING THE PORT 4 .4 AS TX

P4SEL = BIT5;// SELECTING THE PORT 4.5 AS RX

UCA1CTL1 = UCSWRST; // RESET BEFORE THE PROCESS

UCA1CTL1 = UCSSEL_1;  //SELECTION OF CLK SPEED ACLK=32.768 HZ


UCA1BR0=8; //BAUD RATE GENERATION

UCA1BR1=0; // BAUD RATE SELECTION

UCA1MCTL = UCBRS_0 | UCBRF_13 | UCOS16;  // MODULATION CONTROL AND OVERSAMPLING.

UCA1CTL1 &= ~UCSWRST; INITIALISING USART STATE MACHINE.

P1DIR = 0XFF; // ENABLING THE PORT 4 PINS
P1OUT =0XFF; // MAKING THE OUTPUT FOR LED
while

{

UCA1TXBUF = 'a' ; //TRANSMITTING THE CHARACTER 'a' through transmit buffer

P1OUT ^= 0XFF; //  BITWISING OR THE OUTPUT in loop.

for(i=0;i<5000;i++) // LOOP

{



}

}

}
.


SO,MY WAY OF GETTING OUTPUT IS THAT WHEN CHARACTER 'a' is transmitted,led should blink in provided for loop.But i coudnt get the output.Plz anyone help on this.
 
Last edited by a moderator:
I'm not familiar with that CPU, but this part looks strange:

Code:
P4SEL = BIT4; //SELECTING THE PORT 4 .4 AS TX

P4SEL = BIT5;// SELECTING THE PORT 4.5 AS RX

You are overwriting (so replacing) the first value with the second, so only the RX bit is set?

If you are trying to set both bits, try

Code:
P4SEL = BIT4 | BIT5; //SELECTING THE PORT 4 .4 AS TX AND 4.5 AS RX

That's OR'ing the two bits together, then transferring the combined value to the P4SEL register.
 
I don't know - I know nothing about that CPU, it's just the method of controlling bits in that register that seems wrong, and would have been disabling the "TX" bit.
 
How many times do I need to repeat it?

With your original code, the "TX" pin control bit was disabled!
The UART output could not work.

Have you changed the code as I suggested?

(And please use the "code" insert, in the pulldown between the smileys and camera icons, to make things more readable when adding parts of a program).
 
But why i coudnt get the output?where am i doing the mistake?can anyone spot the error?

Why ask here about an obscure processor no one has heard of? - RS232 is a standard function, surely there are examples from the manufacturer?.
 
Okay.. Since no-one here utilises THAT chip you will get very little help.


Read this first https://www.ti.com/lit/ug/slau410f/...32022&ref_url=https%3A%2F%2Fwww.google.com%2F
 
I just referred all the links and datasheets but there is no improvement. Suggest some more ideas guys plz
Pick a different micro that people know. These request are normally due to some lecturer at a uni picking some obscure device so people can't get answers here. Probably not a bad thing.

Mike.
Edit, you did however get help above which you seem to have completely ignored.
 
Suggest some more ideas guys plz

You still have not answered the question:
Have you changed the program as I suggested and tried it again?

There is no point anyone answering if you do not respond to suggestions made.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…