Reply by Dan Bloomquist February 29, 20122012-02-29
I don't recall the TI example but this looks wrong. I mean this as a
helpful question, 'Why enable an interrupt and not use it?'

Yes, one way is to use a wait state and ignore the interrupt. But it is
there for a good reason, so as to handle tx and rx independent of the
main loop.

So, in the main you want to send a stream.



where 'buf' holds a set of characters. In this example a null terminates
the string.
Say 'buf' is set to "this and that\0".
And if you want returns, "this and that\r\n\0"

Then the only other code you need is the interrupt, do the work there.



No waiting anywhere and the machine can sleep while this is happening.
The tx stops when done as no more interrupts will be generated if
UCA0TXBUF is not set.
Best, Dan.

Beginning Microcontrollers with the MSP430

Reply by philipman2001 February 29, 20122012-02-29
I have had a problem with the TI example code.
Waiting on TX Flag doesn't seem to work.
I did get it working using UCBUSY flag instead. Not very nice.
I would be interested if anyone got TXFlag waiting to work.

Here are my code-
Setup & Config:





Reply by Ramon February 28, 20122012-02-28
I changed the clock to DCO and added the P1SEL2 line now is working, Steve and Jake thank you very much.
Reply by Steve Mayfield February 28, 20122012-02-28
Looks like the Servo Controller wants the position information: low bits (0-6), high bits(7-13)...so:

Reply by Ramon February 28, 20122012-02-28
Im trying to understand all you write but really Im a noob with microcontrollers.

Ok so is this correct?

Reply by Steve Mayfield February 28, 20122012-02-28
That is true, the bit is set after PUC for most of not all of the TI MSP430 parts. I set the bit because my UART init routines are also used for error recovery as well as being safe in case TI changes their minds in the future.
Reply by "Jake G." February 28, 20122012-02-28
Unless some TI example code is wrong (BLASPHEMY), I think some USCI's
,or whatever the abbreviation is, have the UCSWRST already set as a
default, but like I said before I set it every time just to be safe.

Jake G
Reply by Steve Mayfield February 28, 20122012-02-28
You need the sequence below. The 1st line sets the UCSWRST bit putting the UART in "Setup mode". The last line clears the UCSWRST bit putting the UART in "Operational mode". You need to set the UCSWRST bit first before any other bits can be set, so you cannot combine the 1st and 2nd lines in the example below.

Reply by "Jake G." February 28, 20122012-02-28
Hi,
Now I am not sure on this because TI example code I have seen has done
it both ways, but I usually set it at the start of initialization.

my Uart Init code:
for the MSP430F543xA chip



Jake G
Reply by Ramon February 28, 20122012-02-28
I think that I set UCSWRST, I wrotein the code:

UCA0CTL1 &= ~UCSWRST;

Is that incorrect? Im sorry but Im a begginer.