Question: Q 2 [ 4 0 Points ] . You are designing a system to control the brightness of an LED using timer - based Pulse

Q2[40 Points]. You are designing a system to control the brightness of an LED using timer-based Pulse Width Modulation
(PWM) on a microcontroller.
(Part 1) Calculate the period of a PWM signal with a frequency of 1 kHz in microseconds. The microcontrollers clock
frequency is 16 MHz, and the timer uses a prescaler of 64. Calculate the value to be loaded into the timers register
(TA0CCRx value) to achieve a 1 kHz PWM frequency.
(Part 2) Given the calculated TA0CCRx value from part (1), compute the TA0CCRx for the 50% and 75% duty cycle.
(Part 3) Assume the timer is in 8-bit mode (255 max). Calculate the minimum and maximum achievable PWM fre-
quencies using the 16 MHz clock and a prescaler of 64. Determine the resolution of the duty cycle as a percentage.
(Part 4) Suppose you switch to a 16-bit timer with the same 16 MHz clock and a prescaler of 64. Calculate the
maximum TA0CCRx value. Calculate the minimum achievable PWM frequency.
Q3[20 Points]. A push button is used to control an LED based on these rules: (1) Every time the push button is pressed,
the LED turns ON for 5 seconds; (2) If the button is pressed again within the 5-second window, the timer resets, and the
LED stays ON for another 5 seconds from the latest press. A user interacts with the button as follows:
Press 1: Time =0 seconds
Press 2: Time =3 seconds
Press 3: Time =8 seconds
Press 4: Time =12 seconds
(Part 1) Calculate the total time the LED stays ON based on the button press sequence. Provide a timeline showing
the ON and OFF states of the LED.
(Part 2) Explain if there are any periods where pressing the button has no effect and why that happens.
(Part 3) Consider a scenario where the button is pressed every 4 seconds starting at Time =0 seconds. How long
would the LED remain ON by the 20th press?

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 Electrical Engineering Questions!