By AVR
Port A is used to control 8 LEDs each one indicates the presence of a corresponding message. Port B connects to 8 switches which are used to choose the message to hear. Port C connects to 8 other switches which are used to erase the corresponding messages. If a new message exists, the corresponding LED blinks at a frequency of 10 Hz and a corresponding bit in the unsigned 8 hits variable "status" is set to 1. If your grandmother pushes the corresponding switch to listen to the message, the LED stops blinking and is illuminated continuously afterwards till she pushes the other switch to erase the message. When there is no message, the LED is off and the corresponding bit in status is 0. The controller runs at a frequency of 4 MHz. All the switches are read by the microcontroller as 1 when they are pushed and as 0 when they are not pushed. Further, assume that, the LEDs are lit when the corresponding pin of Port A outputs 1 and are turned off when the pin outputs 0. (Check the course notes to see how switches and LEDs are connected.) Write the necessary C code to choose the crystal frequency and configure the three ports. Assume that the code uint8_t status; status = get_status (); allows you to get the status while the function set_status (unit 8_t number); allows you to set the status to any uint8_t value you give. Add to your previous code a piece of C code to make the LED blink if the corresponding bit in status is 1. Change your code to include a variable "heard" to have a bit set to one when the switch to listen to the corresponding message i pushed then cause the corresponding LED to stay on and stop blinking. All this action occurs if the corresponding bit of status is set, i.e. if there is originally a message. Update your code to turn the LED off and clear the corresponding bit of status when the switch to erase the message is pushed