ECE 271 LAB 6 Spring 2012 PURPOSE: Practice in 68HC11 flowcharting, programming, introduction to Pulse Width Modulation. EXERCISE: Write a program which will use Pulse Width Modulation (PWM) to make an LED go dimmer and brighter in response to the pushing of the two buttons (PC1 and PC0). This program will only require one variable, a double byte brightness value. The brightness will take on values between 1 and one less than a "Total count". Use an equate for this total count and set it to 1000. The program should first initialize the brightness value to "1", and then in a loop do the following: Turn on one of the LEDs, then delay an amount proportional to the brightness value (use the X register and count down from the brightness value), then turn off the LED, then delay an amount proportional to the "total count" minus the brightness value, then check the two PortC buttons and increment the brightness if the right button is pressed and decrement the brightness if the left button is pressed. Then loop back. Don't let the brightness exceed its range: if the brightness is 1 then do not decrement it, and if the brightness is one less than the total count, then do not increment it. PRE-LAB: Your flowchart and code must be done before coming in to lab. It will be checked at the beginning of lab and half of your lab grade will come from that. NOTES: 1. Don't forget to org your code and use assembler directives (e.g., equates where appropriate). 2. Your code should follow your flowchart exactly. Program comments will reflect what is found in the flowchart. 3. Doing just the above will get you a 9 out of 10 grade. Do at least 10% more for 10 points. 4. Refer to lab 1 if you can't remember how to use the buttons.