USART Peripheral Library for Harmony v2

This library allows you to:

  • Configure the USART and Baud Rate Generator.
  • Transmit and receive data over the Universal Synchronous/Asynchronous Reciever/Transmitter (USART) interface.

Example Library Functions

USART Configuration
PLIB_USART_BaudRateSet (USART_ID_2, SYS_CLK_PeripheralFrequencyGet(CLK_BUS_PERIPHERAL_2), 9600)
Set USART2 baud rate to 9600
PLIB_USART_Enable (USART_ID_2)
Enable USART2
USART Transmit
PLIB_USART_TransmitterEnable (USART_ID_2)
Enable USART2 transmitter
PLIB_USART_TransmitterBufferIsFull (USART_ID_2)
Check if the USART2 transmit buffer is full
PLIB_USART_TransmitterByteSend (USART_ID_2, 'a')
Transmit the character "a" on USART2
USART Receive
PLIB_USART_ReceiverEnable (USART_ID_1)
Enable USART1 receiver
PLIB_USART_ReceiverDataIsAvailable (USART_ID_1))
Check if data has been received on USART1
PLIB_USART_ReceiverByteReceive (USART_ID_1)
Read data on USART1

 Learn More

 
Harmony USART Tutorial
Learn more >
 
Example Code and Projects
Learn more >
 
Entire USART Driver Interface
Learn more >
 
USART Hardware Description
Learn more >
© 2024 Microchip Technology, Inc.
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.