Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

[10 pts] Consider the following code which is a partial implementation of interr

ID: 3679090 • Letter: #

Question

[10 pts] Consider the following code which is a partial implementation of interrupt-based clock implementation.

byte mins;

byte secs;

byte centisecs;

interrupt VectorNumber_Vtimch0

void timerISR

{

char buffer[9];

… // code for advancing the clock

// format output time in HH:MM:SS format

sprintf(buffer, “%02d:%02d:%02d”, mins, secs,

           centisecs);

    // send out the string to LCD through SPI

    lcdPuts(buffer);

}

Discuss generally why it’s a bad idea to call time-consuming functions like lcdPuts() from the inside of an ISR function. The function sends out a string to the LCD through the SPI module.

Discuss specifically what bad experience a user may have with this implementation.

Explanation / Answer

Hi below i have written the solution for your reference

1.Discuss generally why it’s a bad idea to call time-consuming functions like lcdPuts() from the inside of an ISR function.

It will stall the foreground functions execution and could prevent other interrupts from beingexecuted for a long time.In general, ISRs should be kept as short (i.e. fast) as possible.Time-consuming computations or data processing should be left in the foreground function execution.

2.Discuss specifically what bad experience a user may have with this implementation.

Placing a print to the LCD screen in the time-update ISR may cause the push buttons to become unresponsive because checking if a button has been pushed may not be executed or delayed.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote