This example shows how to send a string of messages through the EUSART peripheral from the PIC18F47Q10 microcontroller (MCU) to the PC and use MPLAB® Data Visualizer to see it.
- Getting Started with UART using EUSART on PIC18
- PIC18-Q10 Product Family Page
- PIC18F47Q10 Data Sheet
- PIC18F47Q10 Code Examples on GitHub
- MPLAB® X IDE v6.05 or newer
- MPLAB® XC8 2.40 or newer
- MPLAB® Code Configurator Melody
- MPLAB® Data Visualizer
- PIC18F-Q_DFP Device Family Pack v1.15.360 or newer
- PIC18F47Q10 Curiosity Nano Development Board is used as a test platform. (DM182029)
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.
The following peripheral and clock configurations are set up using MCC Melody for the PIC18F47Q10:
-
Clock Control:
-
Configuration Bits:
-
EUSART2 Peripheral:
-
UART2:
-
Pin Grid View:
The following pin configuration must be made for this project:
Pin | Configuration | Function |
---|---|---|
RD0 | Digital Output | EUSART2 TX |
In this demo, the message Hello World!
is sent via serial communication every 1000 ms. MPLAB X Data Visualizer is used as a terminal to see the output message.
In this example, EUSART most common configuration is used (asynchronous operation and 8N1 message format), and "Hello World" messages are transmitted. MPLAB X Data Visualizer is used to see the messages on the PC.
This chapter shows how to use the MPLAB® X IDE to program an PIC® device with an Example_Project.X. This can be applied for 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.
-
Clean and build the Example_Project.X project.
-
Select the PICxxxxx Curiosity Nano in the Connected Hardware Tool section of the project settings:
-
Program the project to the board.