Yea. Toss a greater than zero on that numeric and put the actual read in a case statement. Simple solution so you only read when something is there to read.
No. Put a case structure around the read call and the write to the 'read buffer' indicator. The condition on the case structure should be the result of '=0' on the 'bytes at port' read. True case, do nothing. False case, do what you have there now.
View all comments
Show parent comment
1
u/sjaakwortel Nov 02 '25
If bytes is greater than 0 read that number of bytes, otherwise wait.