Baudrate now is configured taking into account the MCU frequency, instead of using fixed values for 8MHz freq

This commit is contained in:
Antonio Lignan 2013-01-29 12:23:23 +01:00
parent 57163df2b7
commit 2cf4e30b11

View file

@ -114,7 +114,7 @@ uart0_init(unsigned long ubr)
UCA0CTL1 |= UCSWRST; /* Hold peripheral in reset state */ UCA0CTL1 |= UCSWRST; /* Hold peripheral in reset state */
UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */ UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */
UCA0BR0 = 0x45; /* 8MHz/115200 = 69 = 0x45 */ UCA0BR0 = ubr; /* 8MHz/115200 = 69 = 0x45 */
UCA0BR1 = 0x00; UCA0BR1 = 0x00;
UCA0MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */ UCA0MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */