Skip to content

Commit

Permalink
16 byte buffer con delay
Browse files Browse the repository at this point in the history
  • Loading branch information
cpantel committed Feb 3, 2018
1 parent f70e0e0 commit 42d3ab7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@ dkms.conf

# Other
.cproject
*/Debug/*
.*.swp

msp430fr6989/.launches
msp430fr6989/Debug

46 changes: 34 additions & 12 deletions msp430fr6989/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#define BR1_FOR_9600 0x00
#define CLK_MOD 0x4911


char buffer[] = "01234567890ABCDEF";

/**
* main.c
*/
Expand Down Expand Up @@ -57,25 +60,44 @@ int main(void)
while (1);
}



#pragma vector=USCI_A0_VECTOR
__interrupt void UART_ISR(void) {
static int pos = 1;
static int lcdIdx = 1;
static int bufferIdx = 0;


P9OUT ^= BIT7;
uint8_t l = UCA0RXBUF;
if (l == 'A' ) {
P1OUT = BIT0;
myLCD_showSymbol(LCD_TOGGLE, LCD_HRT, 0);
} else {
P1OUT = 0x00;
}
myLCD_showChar(l,pos);
++pos;
if (pos > 6) pos = 1;

uint8_t charRead = UCA0RXBUF;

myLCD_showSymbol(LCD_UPDATE, LCD_RX, 0);

myLCD_showChar(charRead,lcdIdx );

buffer[bufferIdx]=charRead;

++lcdIdx;
++bufferIdx;

if (lcdIdx > 6) lcdIdx = 1;

if ( bufferIdx > 15) {
for (bufferIdx = 0; bufferIdx < 16 ; ++bufferIdx) {
UCA0TXBUF = buffer[bufferIdx];
//UCA0IFG = UCA0IFG & ( ~UCTXCPTIFG);
int delay = 0;
for (delay = 0; delay < 30000; ++delay);
myLCD_showSymbol(LCD_TOGGLE, LCD_TX, 0);

}
bufferIdx = 0;

}

UCA0TXBUF = l;
UCA0IFG = UCA0IFG & ~(UCRXIFG);

myLCD_showSymbol(LCD_CLEAR, LCD_RX, 0);

}

0 comments on commit 42d3ab7

Please sign in to comment.