Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Essential type of the left hand operand usart[0U].tx_count (unsigned) is not the same as that of the right operand "0" (signed).

if(usart[RS485_PORT].tx_count == 0) // error in this line
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

0 is a literal of type int which is a signed type, and tx_count is an unsigned field. Comparison between signed and unsigned are usually unexpected

To make the right hand side unsigned add the U suffix

if(usart[RS485_PORT].tx_count == 0U)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...