AVR128DA48 LED Blink Using a PWM Signal Code Example
 
 
 
Go to file
Marius Nicolae 7b086336f2 MPAE-9957 update metadata 2021-02-17 12:01:41 +02:00
.main-meta
avr128da48-cnano-led-blink-pwm-mcc.X
images
.gitignore
Jenkinsfilek8s
README.md
cloudprovider.yml

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:

TCA1:

  • Single-slope PWM Mode
  • Compare channel 2 enabled
  • Input clock 4Mhz divided by 16
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 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.