AVR128DA48 LED Blink Using a PWM Signal Code Example
 
 
 
Go to file
Stefan Vlad e1c767da42 MPAE-11547: Updated README.md 2021-06-16 06:21:07 -06:00
.citd MCU8QA-467 added new CICD files 2021-03-31 13:13:52 +05:30
.main-meta MPAE-11547: Updated metadata 2021-06-16 14:46:35 +03:00
avr128da48-cnano-led-blink-pwm-mcc.X MPAE-11547: Updated metadata,readme,project files 2021-06-16 12:36:11 +03:00
images MPAE-9897 fix metadata and readme 2021-02-16 15:30:44 +02:00
.gitignore MPAE-5596 add support files 2020-08-04 11:43:38 +03:00
README.md MPAE-11547: Updated README.md 2021-06-16 06:21:07 -06:00

README.md

MCHP

AVR128DA48 LED Blink using PWM Code Example

This repository provides a MPLAB X project with a MCC generated code example for an LED blink driven by a 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

Setup

The AVR128DA48 Curiosity Nano Development Board is used as test platform

The following configurations must be made for this project:

Clock:

  • 4 MHz clock with Prescaler Division of 16 (250 kHz actual)

TCA1:

  • Single-slope PWM Mode
  • Compare channel 2 enabled with 50% duty cycle
  • System clock 250 kHz
  • Requested timeout 262ms
Pin Configuration
PC6 (LED0) Digital Output

Operation

  1. Connect the board to the PC.

  2. Open the avr128da48-cnano-led-blink-pwm-mcc.X project in MPLAB® X IDE.

  3. Set avr128da48-cnano-led-blink-pwm-mcc.X project as main project. Right click on the project in the Projects tab and click Set as Main Project.

  4. Select the AVR128DA28 Curiosity Nano in the Connected Hardware Tool section of the project settings:

  • Right click on the project and click Properties;
  • Click on the arrow right next to Connected Hardware Tool;
  • Select the AVR128DA28 Curiosity Nano (click on the SN), click Apply and then click OK:
  1. Program the project to the board: right click on the project and click Make and Program Device.

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.