Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 (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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started