EmbeddedRelated.com
Forums

Help with serial comunication and Servo controller

Started by Ramon February 28, 2012
Im trying to understand all you write but really Im a noob with microcontrollers.

Ok so is this correct?

Beginning Microcontrollers with the MSP430

Looks like the Servo Controller wants the position information: low bits (0-6), high bits(7-13)...so:

I changed the clock to DCO and added the P1SEL2 line now is working, Steve and Jake thank you very much.
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:





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.