Question: Aim: Using interrupts to cycle through LEDs and control their brightness using PWM . For this experiment, you will need to consult the usual reference

Aim: Using interrupts to cycle through LEDs and control their brightness using PWM.
For this experiment, you will need to consult the usual reference documents:
LPC824 user manual
LPC82x datasheet
Alakart schematic diagram
Write the code using the peripheral support libraries (Xpressso SDK).
In this experiment, we will keep the three LED configuration, but only one external switch. The three LEDs will be turned ON sequentially using a timer INT and their brightness will be cycled by pressing the external button. The external button will be connected through a pin interrupt (PINT).
The main loop of the program must not do anything. It must be completely empty.
PART I
Construct a circuit consisting of three LEDs of any color you like and one external button.
Make sure that the processor system clock is configured to 30 MHz (you may copy the clock configuration code provided in the class example projects)
Configure the MRT timer such that it generates an INT every 10 ms .
Write an ISR for the MRT. The ISR must have a counter that counts to 50, turns off the current LED and turns on the next LED.
At this stage, you should get a sequencer that changes to the next LED every 500 ms .
Use a chronometer to check that you really get the correct timing. (Time 10 complete sequences and make sure it is close to 15s=1030.5s)
Note: The clock input of the MRT is the "system clock" which is set to 30 MHz . See Appendix 1 and also "Fig. 49 MRT clocking" of the user manual.
Write in your report:
What values must be written to which registers so that the desired INT frequency of 10ms can be accomplished.
Store the code for this part in a folder named "EX2_PART1".
PART II
In PART I, we built a LED light sequencer. Now we will add LED brightness functionality to the light sequencer by using PWM. Keep the code in PART I and add the following to it:
Connect the LEDs to the outputs of the SCT using the SWM peripheral.
Configure the SCT to generate a PWM signal such that the brightness of the LEDs can be changed.
Configure the PWM frequency to be 1 kHz .
The MRT INT should still be active, and still served by the ISR as in PART I.
Every 500 ms , change the PWM duty ratio of the currently ON LED to 0%, and the next LED to 60%.(You can use more or less PWM duty ratio to get a visually pleasing brightness.)
As a result, we should be getting the same effect as in PART I, but the LEDs should be dimmer.
Write in your report:
How the SWM is configured so that the LEDs are now connected as PWM outputs of SCT. What values must be written to which registers?
How the SCT is configured to produce 3 PWM outputs. What values must be written to which registers?
Store the code for this part in a folder named "EX2_PART2".
I want a part 2 code.
Aim: Using interrupts to cycle through LEDs and

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!