SP.710: Intro to Microcontrollers

Day 8: timing, PWM (pulse-width modulation), and LED dimming

We will talk about timers, frequencies, and PWM.
There is also a handout that demonstrates the ugly way
  you can do timing in C.

1) Write code, using delay_us (no fancy RTCC counter stuff)
    to flash the LED at a frequency of 50kHz (20us period).
    (50% duty cycle)
   Verify on an oscilloscope that the LED is flashing at the
    correct frequency.

2) Write code, using delay_us, to flash the LED at a frequency
    of 50 kHz, but with a 20% duty cycle (it should be dimmer).
   Verify on an oscilloscope that the LED is flashing at the
    correct frequency and duty cycle.

3) Same as #1, but use the RTCC (modify the timing1.c source code)

4) Same as #2, but use the RTCC

5) Make the LED "fade in" from dim to bright