You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
945 B
C

#include <msp430.h>
#include "foci.h"
int main()
{
WDTCTL = WDTPW | WDTHOLD;
DCOCTL = 0;
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
P1SEL = BIT1 | BIT2; // P1.1 = RXD, P1.2=TXD
P1SEL2 = BIT1 | BIT2; // P1.1 = RXD, P1.2=TXD
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 104; // 1MHz 9600
UCA0BR1 = 0; // 1MHz 9600
UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1
UCA0CTL1 &= ~UCSWRST;
init();
foci_putchar('o');
foci_putchar('k');
foci_putchar('\n');
for (;;) {
interpret();
foci_putchar('o');
foci_putchar('k');
foci_putchar('\n');
//printf(compiling() ? "compiled <%d>\n" : "ok <%d>\n", depth());
}
}
void foci_putchar(int ch)
{
while (!(IFG2 & UCA0TXIFG));
UCA0TXBUF = ch;
}
int foci_getchar(void)
{
int ch;
while (!(IFG2 & UCA0RXIFG));
ch = UCA0RXBUF;
foci_putchar(ch);
return ch;
}