Altera_Forum
Honored Contributor
20 years agoproblem of "if" condition
I wrote a program to process data from PC through uart, but there is something wrong.
<div class='quotetop'>QUOTE </div> --- Quote Start --- main() { ...... init_uart0(); ...... while(1) { if(uart0_rbuf_out_cnt != uart0_rbuf_in_cnt ) { ...... } } }[/b] --- Quote End --- I receive data in uart0_ISR(), if there is one new byte, at first put it into the uart0_rbuf, and then the uart0_rbuf_in_cnt add 1. The problem is when (uart0_rbuf_out_cnt != uart0_rbuf_in_cnt ) is true, it can not go into the program to process the data. What's the matter?Thanks.