ECE 3567 Microcontroller Lab 3 Pulse Width Modulation
ECE 3567 Microcontroller Lab #3 – Pulse Width Modulation and the LED Test Mode Spring 2019 Dr. Gregg Chapman 1
ECE 3567 Microcontroller Lab This week, you are given MOST of the code for LED Test Mode. 2
Lab 3 Main() 3
ECE 3567 Microcontroller Lab Download and install the project from the ECE 3567 Lab 3 website. 4
Lab 3 – The LED Test Mode First of THREE Modes: 1. LED Test Mode 2. Temperature Measurement Mode 3. RC Voltage Feedback Mode 5
Lab 3 Compile and Program Lab Add the following Commands to parse_Command() LT – Activate LED Test Mode LR = Red LED LO = Orange LY – Yellow LG – Green LB – Blue LP – Purple LD – LED Test Mode Disable 6
Lab 3 Compile and Program Lab Add the following Pulse Width Definitions in update_RGB() NOTE: This is in RGB_LED. c if(LED_Test == TRUE) { if(LED_Color == Red) { // Red. Includes Flash duty_cycle_red = 0 x 070; duty_cycle_green = 0 x 000; duty_cycle_blue = 0 x 000; 7
Lab 3 Add the following Pulse Width Definitions in update_RGB() NOTE: This is in RGB_LED. c } else if(LED_Color == Orange) // Orange { duty_cycle_red = 0 x 0 E 4; //FF duty_cycle_green = 0 x 014; // 30 duty_cycle_blue = 0 x 000; } 8
Lab 3 Add the following Pulse Width Definitions in update_RGB() NOTE: This is in RGB_LED. c } else if(LED_Color == Yellow) // Yellow { duty_cycle_red = 0 x 0 E 4; //FF duty_cycle_green = 0 x 08 B; // D 7 duty_cycle_blue = 0 x 000; } 9
Lab 3 Add the following Pulse Width Definitions in update_RGB() NOTE: This is in RGB_LED. c else if(LED_Color == Green) // Green { duty_cycle_red = 0 x 000; duty_cycle_green = 0 x 04 A; duty_cycle_blue = 0 x 000; } else if(LED_Color == Blue) // Blue { duty_cycle_red = 0 x 003; duty_cycle_green = 0 x 003; duty_cycle_blue = 0 x 07 A; } 10
Lab 3 Add the following Pulse Width Definitions in update_RGB() NOTE: This is in RGB_LED. c else if(LED_Color == Green) // Green { duty_cycle_red = 0 x 000; duty_cycle_green = 0 x 04 A; duty_cycle_blue = 0 x 000; } else if(LED_Color == Blue) // Blue { duty_cycle_red = 0 x 003; duty_cycle_green = 0 x 003; duty_cycle_blue = 0 x 07 A; } 11
Lab 3 Checkpoints 1. 2. 3. 4. 5. Green LED illuminates when the UART is Connected LT is written to the LCD when the command is sent All 6 colors appear for the Color Commands in LT Mode. LD disables the LED LE Enables the LED 12
- Slides: 12