Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions