UART – Simple demo with UART1

  1. What this example do?
  2. How I must configure my ORbit16™ to work with this example?
  3. Where I can learn more about this?
  4. Download this example!

What this example do?

In this example we’ll learn how to use PPS (Peripheral Pin Select) feature and then the UART (Universal Asynchronous Receiver/Transmitter) peripheral. The UART is used for interfacing to a lot of devices and to PC through COM ports. Is also used to realize RS485 links through dedicated transceivers. On the ORbit16™ we can assign the UART interface to ports we like. Since on ORbit16™ there are 2 UARTS, we’ll call them UART1 and UART2. In this example we are going to configure UART1 only, in the next example we’ll use UART2 to make everyone happy!

When you press SW2 on ORbit16™, it answers back with a message sent on serial port. In the meanwhile, L2 will flash indipendently using interrupt on Timer1.

How I must configure my ORbit16™ to work with this example?

For this example you need a serial adapter since the UART on ORbit16™ works at 3.3V. So if you’ve a COM port on you PC, you need an adapter from RS232 to TTL level at 3.3V. If your PC doesn’t have a COM port, you can use an USB/TTL adapter. Please remember your adapter must works with a TTL level of 3.3V.

Using the PPS feature we redirect the UART1 Transmit on port RP15 and UART1 Receive on RP14 (for compactness those ports are identified as P14 and P15 on the ORbit16™). Don’t forget to connect ground lines together! Here are shown the connections with a 990.004 USB to Serial Micro Converter  from (click the image to enlarge):

We configure the UART1 peripheral to works at 57600bps, 8 data bits, 1 stop bit, No parity. You can use any terminal software on your pc to see the messages sent by ORbit16™ when you press SW2:

Where I can learn more about this?

My advice is to read the following free documents:

  • dsPIC30F_dsPIC33F_PIC24H_UART_Help.htm (english language)
    This is an HTML file you’ve got with MPLAB C30 installation. Usually this document is located in the following folder:

    C:\Program files\Microchip\MPLAB C30\docs\periph_lib

    Reading document this will give you extra skills in the usage of UARTs.

  • PIC24F Family reference manual (english language)
    This is a set of PDFs about PIC24F features. Read:
    Sect.12 – I/O Ports with Peripheral Pin Select
    Sect.21 – UART
  • Rimappare le periferiche sui pic a 16 bit (italian language)
    This article talks about the PPS feature on dsPIC and PIC24. Is located here. You can translate this page using Google Translate, but beware of the translation since Google translates the code too!

Download this example!

This file is in ZIP format
UART1 - Simple
239.54 kB - Downloaded 49 times