1 //! MSP430F1612/1611 clock and I/O definitions
6 #include <util/delay.h>
9 unsigned char serial0_rx(){
10 while( !(UCSR0A & (1 << RXC0)) );
15 unsigned char serial1_rx(){
20 void serial0_tx(unsigned char x){
21 while (!(UCSR0A & (1<<UDRE0)) );
25 //! Transmit a byte on the second UART.
26 void serial1_tx(unsigned char x){
29 //! Set the baud rate.
30 void setbaud0(unsigned char rate){
31 //TODO support multiple rates.
54 uint16_t bittimer=( F_CPU / SPEED / 16 ) - 1;
55 UBRR0H = (unsigned char) (bittimer >> 8);
56 UBRR0L = (unsigned char) bittimer;
59 /* set the framing to 8N1 */
60 UCSR0C = (3 << UCSZ00);
62 UCSR0B = (1 << RXEN0) | (1 << TXEN0);
67 //! Set the baud rate of the second uart.
68 void setbaud1(unsigned char rate){
69 //http://mspgcc.sourceforge.net/baudrate.html
91 void msp430_init_uart0(){
95 void msp430_init_uart1(){
100 //! Initialization is correct.
101 void msp430_init_dco_done(){
102 //Nothing to do for the AVR w/ xtal.
106 void msp430_init_dco() {