Functional Requirements

You are required to recreate one of the Arduino functions.

  • You must be able to set an arbitrary delay (in milliseconds) using your own function, mimicking the behavior of delay().
  • You must be able to turn on and off an LED attached to pin 13. Each second you must toggle the state of the LED.

Technical Requirements

This section will serve as a guideline of what is necessary for the program to behave correctly.

You need to implement the following functions:

  • void delay_one_ms(): This function uses Timer0 to implement a one millisecond delay. Follow the steps below to get this function working properly:
    • Choose a prescaler for the desired delay
    • Disable the I-Flag in the SREG. Alternatively, save a copy of SREG to restore later.
    • Set the proper value in TCNT0.
    • Set Timer0 to Normal Mode.
    • Set the prescaler bits.
    • Wait until the overflow flag TOV0 is set.
    • Stop the clock.
    • Clear the TOV0 flag by setting it.
    • Restore the interrupts by setting the I-Flag in the SREG. Or load SREG from the copy you made before.
void delay_one_ms(){
  ...
}
  • void delay_generic(unsigned long ms): This function calls the delay_one_ms() function to implement a delay for an arbitrary amount of milliseconds. This function recreates the behavior of the Arduino delay() function.
void delay_generic(unsigned long ms){
  ...
  // call delay_one_ms()
  ...
}

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!