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 |