Skip to content

Latest commit

 

History

History
102 lines (65 loc) · 4.43 KB

File metadata and controls

102 lines (65 loc) · 4.43 KB

MCHP

AVR128DA48 - Demo of printf With Floating Point Numbers Using USART and MCC Melody

This repository provides an MCC Melody generated MPLAB® solution for a basic printf demo using the USART interface to demonstrate the floating point usage.

This application shows an example of how to handle and print floating point numbers. It prints on the serial value incremented by 0.5 and toggles the on-board LED every second.

Related Documentation

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 a test platform.

The following configurations must be made for this project:

  • System clock configured at 4 MHz
  • USART1:
    • 115200 baud
    • 8 data bits
    • no parity bit
    • 1 stop bit
Pin Configuration
PC6 (LED0) Digital Output
PC0 (USART1_TX) Digital Output
PC1 (USART1_RX) Digital Input

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.

Demo:

Using Control Panel or the system's configuration tool, identify the serial port number allocated by the OS (COMx, ttySx, etc).

Open Microchip Data Visualizer, choose the 115200 format, then connect to the appropriate serial port.

A message with "Hello World!" will appear on the first line and the next one shows the CPU frequency. Then, the on-board LED starts toggling once per second, while the serial terminal displays an incrementing floating point number.


This image shows the received messages from the start of the program. The program will continuously increment the value with 0.5 every second.

Summary

The demo shows a printf demo using floating point numbers on the AVR128DA48 Curiosity Nano Board.

Back to top

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 to any other projects.

  • Connect the board to the PC

  • Open the Example_Project.X project in MPLAB® X IDE

  • Set the Example_Project.X project as main project

    • Right click the project in the Projects tab and click Set as Main Project
  • Clean and build the Example_Project.X project

    • Right click the Example_Project.X project and select Clean and Build
  • Select AVRxxxxx Curiosity Nano in the Connected Hardware Tool section of the project settings:

    • Right click the project and click Properties
    • Click the arrow under the Connected Hardware Tool
    • Select the AVRxxxxx Curiosity Nano (click the SN), click Apply and then OK:
  • Program the project to the board

    • Right click the project and then Make and Program Device