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

What is wrong with this simplified Embedded C code? void interruptHandler() { //

ID: 3725849 • Letter: W

Question

What is wrong with this simplified Embedded C code?
void interruptHandler()
{
// write to a register on hardware 
// to enable functionality
delayInSeconds(1); // delay for 1 second
// read value back
}
void main()
{
while (1)
{
// write to a register on hardware 
// to enable functionality
delayInSeconds(1); // delay for 1 second
// read value back
// do something else
}
}
unsigned int timerTicks = 0;
void timerInterruptHander(void)
{
timerTicks++;
}
void main()
{
unsigned int initialTicks = timerTicks;
while (1)
{
if ((initialTicks + 10) < timerTicks)
flashLED(); // function defined elsewhere
}
}

Explanation / Answer

In above code there is a two main function please check it you should have one main function only

and the interruptHandler should be called from the first main function inside the while loop and delete the same code written in that while loop

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