Forum Discussion
Altera_Forum
Honored Contributor
20 years agoHow to tell there is data from UART?
Hi Browsing through Altera documentation suggests I should be using the HAL with a UART. So using the HAL how do I determine if there is data available from the UART before calling getchar...
Altera_Forum
Honored Contributor
20 years agoopen device uart in non blocking mode:
static int fdterm; // FILEDESCRIPTOR RETURNED BY OPEN .. fdterm = open("/dev/uart1", O_RDWR | O_NONBLOCK | O_NOCTTY); .. reading is done by .. res=read(fdterm,uart1_tempbuff,sizeof(uart1_tempbuff)-1); if(res>0) { ... we have received some bytes }