Synchronous/Asynchronous serial communication is often used to communicate between the microcontroller and other peripheral devices that expand the microcontroller’s capabilities without radically changing the design. A few good examples that use the EUSART are the RN41 wireless module and the CAN bus technology, as well as many others. EUSART is especially useful for the RS-232 protocol as well as RS-422 and RS-485. One example of the RS-232 protocol would be communication with a PC Terminal Program.

EUSART communication style is useful because it only requires two pins, with no clock pin in asynchronous mode. It is also simpler than other serial protocols to understand. However, its limitations lie in the fact that each set of two pins can only facilitate communication between 1 pair of microcontrollers, as opposed to other serial protocols which may not require additional data lines (think additional pins on your microcontroller) to add controllers to the communication process.

Locating the EUSART

Basic Use

Enable EUSART: This box selection enables the EUSART peripheral.

Enable Transmit: EUSART communication has two lines, one for transmitting, labeled TX. The other for receiving, labeled RX. Rx will automatically be enabled but this box enables the transmit capabilities.

Baud Rate: The baud rate insures the data transmission rate of the controller sending out the signal is the same as that of the controller receiving the signal. If these are different, the controllers will not be able to communicate because the pulses of the information bits will be different lengths. 9600 is a fairly common rate, but you can set it to other baud rates as well.

Redirect STDIO to USART: Some of the more common functions in programming such as printf(), putchar() and puts() are included in the STDIO (stdio.h) library. Checking this box allows use of this functionality. Keep in mind that this will require additional memory to accommodate the stdio.h libraries.

Configuring the Pins in MCC

As previously mentioned, the EUSART uses two pins; TX and RX. These will connect to the opposite pin on the other microcontroller being communicated with, (i.e the TX of the Xpress board will be connected to the RX of the other microcontroller and vice versa).

To select these pins, click the chosen locks in the MCC Pin Manager:

The RC0 and RC1 are chosen here because these connections will allow the PIC16F18855 based Xpress board to communicate with the PC for testing and developing applications using a terminal on the computer.

Using Basic Software Functionality in main.c file

MCC will generate library files that contain custom functions for the EUSART. The eusart.h header file contains 3 functions, all of which are important to the data communication process. Find this file under the Project tab as seen in the figure above.

Software Function (found in eusart.h)

What it does

void EUSART_Initialize(void);

This function sets-up all the preset register values for the eusart on launch and must be called in the beginning of a code using the EUSART functionality.

uint8_t EUSART_Read(void);

This function reads a byte of data from the incoming signal on the RX line.

void EUSART_Write(uint8_t txData);

This function writes a byte of data to the TX line to be read by the other microcontroller or computer.

Another important aspect to keep in mind is the functionality of the STDIO library, which provides a very efficient way to accomplish the same things as the functions above.

Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.

Click here to edit contents of this page.

Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.

Append content without editing the whole page source.

Check out how this page has evolved in the past.

If you want to discuss contents of this page - this is the easiest way to do it.

View and manage file attachments for this page.

A few useful tools to manage this Site.

See pages that link to and include this page.

Change the name (also URL address, possibly the category) of the page.