Coder Social home page Coder Social logo

microchip-pic-avr-examples / pic16f15244-eusart-example Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 729 KB

This demonstrates the use of the EUSART module to transmit "Hello World" to a PC terminal.

Makefile 6.46% C 93.54%
core-independent display melody sensor serial-communication

pic16f15244-eusart-example's Introduction

MCHP

Transmit "Hello World!" to a Terminal Program using EUSART with PIC16F15244

The 'pic16f15244-eusart-example' code example uses the PIC16F15244 Curiosity Nano Development board to demonstrate how to transmit "Hello World!" to a PC terminal application using the EUSART module.

PIC16F15244 Curiosity Nano Development Board:

Curiosity Nano Development Board

Related Documentation

Software Used

Hardware Used

Setup

  1. Connect the PIC16f15244 Curiosity Nano board to a PC using the Micro-USB to USB 2.0 cable.
  2. If not already on your system, download and install MPLABX IDE version 6.15 or newer.
  3. If not already on your system, download and install the XC8 C-Compiler version 2.45 or newer.
  4. Open the 'pic16f15244-eusart-example.X' project (see Figure 1).
Figure 1: Open Project Window

Open Project Window

  1. Click on the 'Project Properties' button to open the Project Properties window. Select the Curiosity tool from the Connected Hardware Tool drop-down menu (see Figure 2).
Figure 2: Select the Nano in Project Properties Window

Select Tool

  1. Click on the 'Make and Program Device' button to program the PIC (see Figure 3). Verify that the device is successfully programmed (see Figure 4).
Figure 3: 'Make and Program Device' Button

Program Device Button

Figure 4: Program Complete

Program Complete

  1. Open a terminal program on your PC. For this example, Tera Term was used as the terminal program.

a. Port Selection is used by the Nano board (see Figure 5).
b. Configure the serial port (see Figure 6).

Figure 5: Select the USB Port

Select USB Port

Figure 6: Configure the Serial Port

Configure Serial Port

Operation

After the Nano board is programmed, the EUSART module will transmit the string "Hello World!" to the PC terminal window at a baud rate of 9600 bps. Output pin RC0 is configured as the TX output through PPS. Nano hardware also connects pin RC0 to the USB receive line, allowing a quick connection to the PC terminal without any additional wires or USB bridge circuits.

The EUSART module is configured to use the printf() function call that is built into the XC8 libraries. In MCC, simply mark the 'Redirect STDIO to USART' check-box (see Figure 7), and the additional function call are added to the project. Example 1 shows the use of the printf() function.

Figure 7: 'Redirect STDIO to USART' Check-box

STDIO to USART

Example 1: Main() Code Snippet
void main(void)
{
    SYSTEM_Initialize();                   // Initialize the device

    while (1)
    {
        printf("Hello World! \r\n");       // Write over EUSART
        __delay_ms(2000);                  // Two second delay
    }
}

Summary

The 'pic16f15244-eusart-example' code example uses the PIC16F15244 Curiosity Nano Development board to demonstrate how to transmit "Hello World!" to a PC terminal application using the EUSART module. Once programmed, the EUSART will transmit the string 'Hello World!' to a PC terminal program.

Figure 8: Hello World!

Hello World!

pic16f15244-eusart-example's People

Contributors

aku-work avatar ashishmakthal avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.