AVR128DA48 LED Blink Using a PWM Signal Code Example
 
 
 
Go to file
Mihai Alexandru Ricanu d2f4222243 MPAE-16196 Implemented TW feedback 2023-08-11 10:42:01 +03:00
.citd MCU8QA-467 added new CICD files 2021-03-31 13:13:52 +05:30
.main-meta MPAE-16196 Updated metadata 2023-08-04 14:10:23 +03:00
avr128da48-cnano-led-blink-pwm-mcc.X MPAE-16196 Updated project and readme file 2023-08-04 13:45:36 +03:00
images MPAE-16196 Updated project and readme file 2023-08-04 13:45:36 +03:00
.gitignore MPAE-5596 add support files 2020-08-04 11:43:38 +03:00
README.md MPAE-16196 Implemented TW feedback 2023-08-11 10:42:01 +03:00

README.md

MCHP

AVR128DA48 LED Blink Using a PWM Signal Code Example

This repository provides an MPLAB® X project with an MPLAB Code Configurator (MCC) generated code example for an LED blink driven by a Pulse-width modulation (PWM) signal. The example demonstrates how to generate a PWM signal using a timer. The output waveform is connected to the on-board LED. The PWM duty cycle value is set at 50%. For half of the period the LED is turned ON, and for the other half the LED is turned OFF.

More details and code examples on the AVR128DA48 can be found at the following links:

Software Used

Hardware Used

Operation

To program the Curiosity Nano board with this MPLAB X project, follow the steps provided in the How to Program the Curiosity Nano Board chapter.

Setup

The following configurations must be made for this project:

  • Clock Control:

    • Clock Selection: Internal high-frequency oscillator
    • Internal Oscillator Frequency: 1-32 MHz internal oscillator
    • Oscillator Frequency Selection: 4 MHz system clock
    • Prescaler Enable: Yes
    • Prescaler Division: 16X
  • Configuration Bits:

    • Watchdog Timeout Period: Watch-Dog timer off
  • Interrupt Manager:

    • Global Interrupt Enable: No
  • TCA1:

    • Enable Timer: Yes
    • Clock Selection: System Clock
    • Requested Timeout: 262 ms
    • Waveform Generation Mode: Single Slope PWM
    • Enable Channel 2: Yes
    • Duty Cycle 2: 50%

Pin Configuration
PC6 (LED0) Digital Output


Demo


Summary

The demo shows how to generate a PWM signal using Timer/Counter Type A (TCA). The output of the TCA is connected to the on-board LED of the AVR128DA48 Curiosity Nano board and a waveform signal is generated.

How to Program the Curiosity Nano board

This chapter shows how to use the MPLAB X IDE to program an AVR® device with an Example_Project.X. This can be applied for any other projects.

  1. Connect the board to the PC.

  2. Open the Example_Project.X project in MPLAB X IDE.

  3. Set the Example_Project.X project as main project:
    Right click on the project in the Projects tab and click Set as Main Project.

  4. Clean and build the Example_Project.X project:
    Right click on the Example_Project.X project and select Clean and Build.

  5. Select AVRxxxxx Curiosity Nano in the Connected Hardware Tool section of the project settings:
    Right click on the project and click Properties
    Click on the arrow under the Connected Hardware Tool
    Select the AVRxxxxx Curiosity Nano (click on the SN)
    Click Apply and then OK

  6. Program the project to the board:
    Right click on the project and then Make and Program Device.