Can someone please help me insert the correct code to scroll messages on the LCD screen after receipt of a UART command? My code looks like this now:
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog
// Configure GPIO
P4SEL0 |= BIT2 | BIT3; // USCI_A0 UART operation
P4SEL1 &= ~(BIT2 | BIT3);
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// Startup clock system with max DCO setting ~8MHz
CSCTL0_H = CSKEY >> 8; // Unlock clock registers
CSCTL1 = DCOFSEL_3 | DCORSEL; // Set DCO to 8MHz
CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
CSCTL0_H = 0; // Lock CS registers
// Configure USCI_A0 for UART mode
UCA0CTLW0 = UCSWRST; // Put eUSCI in reset
UCA0CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK
// Baud Rate calculation
// 8000000/(16*9600) = 52.083
// Fractional portion = 0.083
// User's Guide Table 21-4: UCBRSx = 0x04
// UCBRFx = int ( (52.083-52)*16) = 1
UCA0BR0 = 52; // 8000000/16/9600
UCA0BR1 = 0x00;
UCA0MCTLW |= UCOS16 | UCBRF_1 | 0x4900;
UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3, interrupts enabled
__no_operation(); // For debugger
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
switch(UCA0RXBUF)
{
case 0x01:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0x10;
break;
case 0x02:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0x3D;
break;
case 0x03:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0x5A;
break;
case 0x04:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0x8B;
break;
case 0x05:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0xA4;
break;
case 0x06:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0xC6;
break;
case 0x07:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0xD1;
break;
case 0x08:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0xE9;
break;
default:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = 0xFE;
}
__no_operation();
break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
}
}
There are 8 commands and a default if none of the 8 commands are received. I need help inserting the correct language to have a unique response appear on the LCD screen after each of these commands.