Skip to content

This example shows how to implement a command line interface. This way, the microcontroller can receive control commands via the EUSART. In this use case, an LED is controlled using commands sent from the MPLAB Data Visualizer.

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f47q10-cnano-eusart-commands-bare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microchip logo

Receive Control Commands via EUSART Using the PIC18F47Q10 Microcontroller

This example shows how to implement a command line interface, enabling the microcontroller (MCU) to receive control commands via the Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART). In this use case, an LED is controlled using commands sent from the MPLAB® Data Visualizer.

Related Documentation

Software Used

Hardware Used

Setup

The PIC18F47Q10 Curiosity Nano development board has an on-board debugger that acts as an USART-to-USB convertor so no further hardware is needed.

The following configurations must be made for this project:

Pin Configuration
RD0 (EUSART2 - TX) Digital output
RD1 (EUSART2 - RX) Digital input
RE0 (LED0) Digital output

Demo

Run the code and configure the Data Visualizer as described in the referenced technical brief document. Type commands to be sent to the board. The two available commands are "ON" and "OFF". Observe the LED on the board as it changes its state according to the command sent. It is convenient to use the line terminator as command delimiter, so for this use case, EUSART will read full lines and then check if the line contains a valid command.

Demo in MPLABX Data Visualizer

Summary

This demo showcases how EUSART can be used to implement a command line interface, allowing the MCU to receive commands via EUSART.

How to Program the Curiosity Nano board

This chapter shows how to use the MPLAB X IDE to program a PIC® device with an ExampleProject.X. This can be applied to any other projects.

  1. Connect the board to the computer.

  2. Open the ExampleProject.X project in MPLAB X IDE.

  3. Set the ExampleProject project as main project.

    Right click the project in the Projects tab and click Set as Main Project.

    Set as Main Project

  4. Clean and build the ExampleProject project.

    Right click the ExampleProject project and select Clean and Build.

    Clean and Build

  5. Select the PIC 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 PIC Curiosity Nano, click Apply and then click OK:

    Select the PIC Curiosity Nano

  6. Program the project to the board.

    Right click the project and click Make and Program Device.

    Make and Program Device

Contents

About

This example shows how to implement a command line interface. This way, the microcontroller can receive control commands via the EUSART. In this use case, an LED is controlled using commands sent from the MPLAB Data Visualizer.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 5