Question: 1.3 Program 3 Use the output pin PB1 and an oscilloscope (or logic analyzer) to create your own delay function. Create your own function: void

 1.3 Program 3 Use the output pin PB1 and an oscilloscope

1.3 Program 3 Use the output pin PB1 and an oscilloscope (or logic analyzer) to create your own delay function. Create your own function: void myHardDelay(uint32_t delayInMsec) that, when called, will delay an integer number of milliseconds before returning. Inside the function create a delay by looping N' delayInMsec times. You will have to experiment to find a value N that provides an accurate delay function. This function should now be used in future projects, replacing the Arduino Wiring library function delay(). 1. What is your value for N? 2. What did you do to prevent the loop in your delay function from being removed by the compiler's optimizer? 3. Using your delay function create a 100 Hz square wave on PB1 and include an oscilloscope (or logic analyzer) screen capture 1. How accurate is your delay function at 1 ms and 50 ms? 5. What it the maximum delay of your myHardDelay function? 1.3 Program 3 Use the output pin PB1 and an oscilloscope (or logic analyzer) to create your own delay function. Create your own function: void myHardDelay(uint32_t delayInMsec) that, when called, will delay an integer number of milliseconds before returning. Inside the function create a delay by looping N' delayInMsec times. You will have to experiment to find a value N that provides an accurate delay function. This function should now be used in future projects, replacing the Arduino Wiring library function delay(). 1. What is your value for N? 2. What did you do to prevent the loop in your delay function from being removed by the compiler's optimizer? 3. Using your delay function create a 100 Hz square wave on PB1 and include an oscilloscope (or logic analyzer) screen capture 1. How accurate is your delay function at 1 ms and 50 ms? 5. What it the maximum delay of your myHardDelay function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!