Starting from:

$30

CPE 325- Assignment #7 Solved


Assignment                                                                                
Pulse width modulation (PWM) can be used to control power supplied to some devices from the microcontroller. For example, using PWM you can change the brightness of your LED. If the frequency of the PWM signal supplied to an LED is high enough, you will not notice any blinking, but will be able to adjust the brightness by changing the duty cycle of the signal.

1.     Write a program that allows to get 5 levels of brightness of LED1, using Timer B as the source of PWM signal. Make sure the following conditions are met:

a.     No blinking is noticeable due to low PWM frequency.

b.    SW1 increases the level of brightness. If it is clicked at the highest level, nothing happens.

c.     SW2 decreases the level of brightness. If it is clicked at the lowest level, nothing happens.

d.    Take care of SW1 and SW2 debouncing, so that switching between 5 levels of brightness can be clearly observed (without debouncing some levels may be skipped on a key press).

e.     Microcontroller should stay in the sleep mode when no actions are required.

2.     Write a C Program to perform the following functionality:

a.     Use Timer B and the buzzer to produce sound at approximately 1 KHz.  

b.    Toggle the LED1 and produce pulsating sound on the buzzer every second (on after 1 second, off after another second and so on) in the ISR call induced by the watchdog timer.  

c.     Set the microcontroller to the sleep mode when no actions are required.

 

Modify part one so that when you hold both buttons simultaneously, LED1 starts blinking at approximately 0.25 Hz (turning on and off should take 4 seconds) with the current level of brightness. Use watchdog timer for that purpose. Make sure your program returns to the normal mode when the buttons are released. Deliverables 

1. Lab Report: Source files (Indented, formatted Code)



                         

More products