Display the actual alcohol level on the LCD IF alcohol level below the limit THEN Turn on the green LED Send message are under the to the speaker “You limit” Send message can to the speaker “You drive” ELSE IF alcohol level at the limit THEN Turn on orange LED Send message warning you are near the “Warning limit” Send message with to the speaker “Drive caution” ELSE IF alcohol level is above the limit THEN Turn on red LED Send message you are over the “Warning warning limit” Send message do not to the speaker “Warning drive” ENDIF Send message you for being to the speaker “Thank sensible” END Figure 5.1 Operation of the program The complete program listing is given in Appendix A. At the beginning of the program the connection between the LCD and the microcontroller is defined using sbit instructions. The actual connection between the LCD and the microcontroller is as follows: LCD microcontroller
Display the actual alcohol level on the LCD IF alcohol level below the limit THEN Turn on the green LED Send message “You are under the limit” to the speaker Send message “You can drive” to the speaker ELSE IF alcohol level at the limit THEN Turn on orange LED Send message “Warning warning you are near the limit” Send message “Drive with caution” to the speaker ELSE IF alcohol level is above the limit THEN Turn on red LED Send message “Warning warning you are over the limit” Send message “Warning do not drive” to the speaker ENDIF Send message “Thank you for being sensible” to the speaker END Figure 5.1 Operation of the program The complete program listing is given in Appendix A. At the beginning of the program the connection between the LCD and the microcontroller is defined using sbit instructions. The actual connection between the LCD and the microcontroller is as follows: LCD microcontroller