This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4c123 serial interrupt handling



Hello all,

I am trying to recieve characters from computer (UART0) through putty and I AIM to save them in a buffer(array).

I want to print the entire buffer when I press a sw (SW1(PF4)).

However I cant seem to find a way to achieve this. My program is like this:

------MAIN--------------

void UART0_Handler(void)
{
if(UART0_RIS_R & 0x10){

UART0_ICR_R = 0x10;
UART_InString(string,200);

UART_OutString(string);
}

if(UART0_RIS_R & 0x40){

UART0_ICR_R = 0x40;

UART_InString(string,200);
UART_OutString(string);     <-------------------the main call this funtion in uart.c
}

while(1){

for(x=0;x<600000;x++);
if((GPIO_PORTF_DATA_R&0x10)==0)
{
GPIO_PORTF_DATA_R|=0x04;
UART_OutString(string);         <------------------------------------- **want to print the entire string where incoming serial data is stored  when sw pressed it is not                                                                                                                          **printed. Can print any random string by UART_OutString(" print this string")***

}

-------------------------------------

----------UART.c-------------------------

void UART_InString(char *bufPt, unsigned short max) {
int length=0;
char character;
character = UART_InChar();
while((UART0_FR_R&UART_FR_RXFE) == 0){ 


else if(length < max){
*bufPt = character;
bufPt++;
length++;

}
character = UART_InChar();


}
*bufPt = character;
bufPt++;
length++;
}

----------------------------------------

How can I modify my functions to fill the buffer with incoming data and be able to see it as well.

thanks