7b086336f2 | ||
---|---|---|
.main-meta | ||
avr128da48-cnano-led-blink-pwm-mcc.X | ||
images | ||
.gitignore | ||
Jenkinsfilek8s | ||
README.md | ||
cloudprovider.yml |
README.md
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.
Related Documentation
More details and code examples on the AVR128DA48 can be found at the following links:
Software Used
- MPLAB® X IDE 5.40 or newer (microchip.com/mplab/mplab-x-ide)
- MPLAB® XC8 2.20 or a newer compiler (microchip.com/mplab/compilers)
- MPLAB® Code Configurator (MCC) 3.95.0 or newer (microchip.com/mplab/mplab-code-configurator)
- MPLAB® Code Configurator (MCC) Device Libraries 8-bit AVR MCUs 2.3.0 or newer (microchip.com/mplab/mplab-code-configurator)
- AVR-Dx 1.2.52 or newer Device Pack
Hardware Used
- AVR128DA48 Curiosity Nano (DM164151)
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
-
Connect the board to the PC.
-
Open the avr128da48-cnano-led-blink-pwm-mcc.X project in MPLAB® X IDE.
-
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.
-
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:
- 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.