From b0c03db94ac908bf8951a95931fbffbb983ee5ec Mon Sep 17 00:00:00 2001 From: joxe Date: Wed, 27 Feb 2008 19:02:47 +0000 Subject: [PATCH] added USART test git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@151 23d1a52b-0c3c-0410-b72d-8f29ab48fe35 --- tests/cputest.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/cputest.c b/tests/cputest.c index 862c891..e05078b 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -38,6 +38,7 @@ */ #include "msp430setup.h" +#include #include #include @@ -240,6 +241,32 @@ static void testBitFields() { } +/*--------------------------------------------------------------------------*/ +static int flag; +interrupt(UART0TX_VECTOR) + usart_tx_test0(void) +{ + printf("*IRQ: Flags:%d %d\n", IFG1, UTCTL0); + flag++; +} + +static void testUSART() { + int delay = 10000; + testCase("Bit USART Operations"); + flag = 0xff; + UCTL0 = CHAR; /* 8-bit character */ + UTCTL0 = SSEL1; /* UCLK = MCLK */ + ME1 |= (UTXE0 | URXE0); /* Enable USART0 TXD/RXD */ + IE1 |= UTXIE0; /* Enable USART0 TX interrupt */ + TXBUF_0 = 'a'; + + while(flag == 0) { + } + while(delay-- > 0); + + printf("output finished...\n"); +} + /*--------------------------------------------------------------------------*/ int @@ -256,6 +283,7 @@ main(void) testBitFields(); testFunctions(); testModulo(); + testUSART(); /* printf("PROFILE\n"); */ printf("EXIT\n"); return 0;