Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Uart Buffer

Hi all..,

Im new to NIOS2. I want to read a character from Uart. The problem im facing is I can read the character occasionlly till i send 64bytes characters from hyperterminal one by one( UART Buffer size is 64bytes). Once the 64byte buffer is full (circular buffer).. any character i send from the hyperterminal is read by the variable data. please refer the code below.Please help me ..!! Thank u ..

// code ..

unsigned char status,data,block;

block = 1;

do

{

status = IORD_ALTERA_AVALON_UART_STATUS(PORT1_UART_01_BASE);

/* clear any error flags */

IOWR_ALTERA_AVALON_UART_STATUS(PORT1_UART_01_BASE, 0);

if ( status & ALTERA_AVALON_UART_CONTROL_RRDY_MSK) //

{

data = IORD_ALTERA_AVALON_UART_RXDATA(PORT1_UART_01_BASE);

if (!(status & (ALTERA_AVALON_UART_STATUS_PE_MSK | ALTERA_AVALON_UART_STATUS_FE_MSK)))

{

return data;

}

}

}while(block);
No RepliesBe the first to reply