Question: A student uses the code below in a continuous loop to generate a 200 Hz square wave, noting the period of 200 Hz is 5

A student uses the code below in a continuous loop to generate a 200 Hz square wave, noting the period of 200 Hz is 5 ms. 

redled = 1; wait_ms (2.5); redled = 0; wait_ms(2.5); // flash red

He is then surprised to measure a frequency of 250 Hz. Explain why this is so.

redled = 1; wait_ms (2.5); redled = 0; wait_ms(2.5); // flash red led

Step by Step Solution

3.35 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code provided is meant to toggle an LED on and off to create a square wave The student sets the LED on with redLed 1 waits for 25 milliseconds set... View full answer

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 Systems Analysis And Design Questions!