1 //! MSP430F1612/1611 clock and I/O definitions
11 unsigned char serial_rx(){
14 while(!(IFG1&URXIFG0));//wait for a byte
23 unsigned char serial1_rx(){
26 while(!(IFG2&URXIFG1));//wait for a byte
36 void serial_tx(unsigned char x){
37 while ((IFG1 & UTXIFG0) == 0); //loop until buffer is free
41 //! Transmit a byte on the second UART.
42 void serial1_tx(unsigned char x){
43 while ((IFG2 & UTXIFG1) == 0); //loop until buffer is free
47 //! Set the baud rate.
48 void setbaud(unsigned char rate){
50 //http://mspgcc.sourceforge.net/baudrate.html
53 UBR00=0x7F; UBR10=0x01; UMCTL0=0x5B; /* uart0 3683400Hz 9599bps */
56 UBR00=0xBF; UBR10=0x00; UMCTL0=0xF7; /* uart0 3683400Hz 19194bps */
59 UBR00=0x5F; UBR10=0x00; UMCTL0=0xBF; /* uart0 3683400Hz 38408bps */
62 UBR00=0x40; UBR10=0x00; UMCTL0=0x00; /* uart0 3683400Hz 57553bps */
66 UBR00=0x20; UBR10=0x00; UMCTL0=0x00; /* uart0 3683400Hz 115106bps */
71 //! Set the baud rate of the second uart.
72 void setbaud1(unsigned char rate){
74 //http://mspgcc.sourceforge.net/baudrate.html
77 // UBR01=0x7F; UBR11=0x01; UMCTL1=0x5B; /* uart0 3683400Hz 9599bps */
80 //UBR01=0xBF; UBR11=0x00; UMCTL1=0xF7; /* uart0 3683400Hz 19194bps */
83 //UBR01=0x5F; UBR11=0x00; UMCTL1=0xBF; /* uart0 3683400Hz 38408bps */
86 //UBR01=0x40; UBR11=0x00; UMCTL1=0x00; /* uart0 3683400Hz 57553bps */
90 //UBR01=0x20; UBR11=0x00; UMCTL1=0x00; /* uart0 3683400Hz 115106bps */
96 void msp430_init_uart(){
100 void msp430_init_dco() {