Forum Discussion
Altera_Forum
Honored Contributor
16 years agoProgram runs in loop
I have written a program that writes to the user through nios 2 console (jtag uart) and takes user input as well. However, the program does not pause to accept user input. Instead it continues to run...
Altera_Forum
Honored Contributor
16 years agoAhhh, if you're using the small C library, you're going to have to get trickier.
If I remember right, you may may be able to use the regular "read()" function which I think will block. You may also want to access the UART driver directly ...data = IORD_ALTERA_AVALON_JTAG_UART_DATA(JTAG_UART_0_BASE);
if(data & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK){
// If you're here you've got data to read.
data = data & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK;
}else{
// No data try again
} Jake