added USART test

git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@151 23d1a52b-0c3c-0410-b72d-8f29ab48fe35
This commit is contained in:
joxe 2008-02-27 19:02:47 +00:00
parent 5925af30f1
commit b0c03db94a
1 changed files with 28 additions and 0 deletions

View File

@ -38,6 +38,7 @@
*/
#include "msp430setup.h"
#include <signal.h>
#include <stdio.h>
#include <string.h>
@ -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;