summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Knispel <gknispel@avencall.com>2012-08-23 18:11:39 +0200
committerGuillaume Knispel <gknispel@avencall.com>2012-08-23 18:11:39 +0200
commit397c609ffd539aa7518fbfe9c56263b1e063978f (patch)
tree50ca863e18afa03a6c83fb738b0e487eab537691
parent8d97422b552f37459c766ee11dbc3b8164a75b8c (diff)
add UART init function
-rw-r--r--[-rwxr-xr-x]main.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.c b/main.c
index ce22aa1..cad8640 100755..100644
--- a/main.c
+++ b/main.c
@@ -72,6 +72,25 @@ volatile u8 bVCC3 = true;
#define ON_STATE 20
#define RST_WAIT 30
+
+// For UCOS16 = 1
+// BRCLK Baud Rate UCBRx UCBRSx UCBRFx Tx Error Rx Error
+// 12,000,000 115200 6 0 8 -1.8 0 -2.2 0.4
+static void SerialInit(void)
+{
+ UCA0CTL1_bit.UCSWRST = 1;
+
+ UCA0CTL0 = 0;
+ UCA0CTL1 = 0xC1; // UCSSEL=11b => SMCLK; (keep) UCSWRST = 1;
+ UCA0BR0 = 6;
+ UCA0BR1 = 0;
+ UCA0MCTL = 0x81; // UCOS16 = 1; UCBRSx = 0; UCBRFx = 8;
+ UCA0STAT = 0;
+
+ UCA0CTL1_bit.UCSWRST = 0;
+}
+
+
int main(void)
{
u16 state, resetState;