mirror of https://github.com/contiki-ng/mspsim
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:
parent
5925af30f1
commit
b0c03db94a
|
|
@ -38,6 +38,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msp430setup.h"
|
#include "msp430setup.h"
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.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
|
int
|
||||||
|
|
@ -256,6 +283,7 @@ main(void)
|
||||||
testBitFields();
|
testBitFields();
|
||||||
testFunctions();
|
testFunctions();
|
||||||
testModulo();
|
testModulo();
|
||||||
|
testUSART();
|
||||||
/* printf("PROFILE\n"); */
|
/* printf("PROFILE\n"); */
|
||||||
printf("EXIT\n");
|
printf("EXIT\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue