Skip to main content

Project 5 - LED Brightness using PWM (using libraries)

So far we have used and experimented on GPIO modules (in peripherals). Now in this tutorial/project we shall look into PWM module.

From the datasheet of this micro-controller, this MCU has two PWM modules, namely PWM0 & PWM1.

The on-board LED (R+B+G) is connected to PF1, PF2 and PF3 respectively. PF2 and PF3 module is connected to PWM1 module generator 3 and PF1 is connected to PWM1 module generator 2. This project will demonstrate the implementation of PWM1 gen3 to control the brightness of (G+B) LED.

From this project onwards we will be using tivaware. Now lets see how to configure PWM module. 
Steps to configure PWM module:
  1. Set PWM clock
  2. Enable PWM module
  3. Enable GPIO module (so that GPIO can be configured to PWM out)
  4. Set GPIO pins to PWM out
  5. Configure PWM pin modules
  6. Configure PWM generator (count up/count down/ count up-down)
  7. Set the PWM base frequency
  8. Set the PWM pulsewidth
  9. Enable output on PWM pins
  10. Enable PWM generator and set to run mode
Program: Click here to view the file
Back to Project Home Page

Comments

  1. Hello,
    I am getting an error if I run the code "undeclared identifier 'GPIO_PF3_M1PWM7'". If possible can you please update the code. Thanks.

    ReplyDelete

Post a Comment