Hello, in my project work I want to read serially received data continuously and compare it with stored ID in MCU I am using 8051. If the ID match then Green LED will glow, for ID mismatch Orange LED. If no ID found Red LED should glow. In this I am getting problem,when valid Id received it is indicated by Green LED but if we stop sending ID i.e. logically NO DATA in SBUF the Red LED should glow ; it doesn't happen its showing Green Led on...how to solve this one?
Does your program have four valid codes that should result in "green"? Or does it require you to send the four character in proper sequence like a pin code?
By the way - you don't seem to like software comments much. How would a reader know what is controlled by your 4 bitmapped signals?
And your "green" function plays with four signals while the "red" function only plays with two. So what about the two signals that is only handled in green_led_on()? When will they ever get another state?