Uartintc Readme PDF
Uartintc Readme PDF
(for C language)
1. Introduction............................................................................................................................. 2
2. Features................................................................................................................................... 2
6. Functions Details.................................................................................................................... 7
The UART general purpose library module provides ‘C’ functions, which helps the user to transmit
and receive character data through the predifined FIFO (First-in-First-out) buffer . This module
uses the interrupt based transmission and reception of the data. By using these functions user can
concentrate on high-level application development rather than worrying about setting and clearing
the bits of registers . It allows user to do other processing , rather than waiting a lot of time for the
chunk of data to be transmitted or received.
2. Module Features
• Supports user-defined First-in, First-out (FIFO) buffers for both transmission and reception.
• Incorporates interrupt-driven transmission and reception, allowing user other tasks to execute
in the foreground.
• Provides simple functions to read from and write to the buffers.
• It supports PIC18 family devices.
UARTIntC.PIC18.ex.txt This is main test file developed to demonstrate use of the library
functions.
UARTIntC.c This is USART code implementation file. One needs to include this
file in their project.
UARTIntC.h This fine contains definition of shared parameters for user. One
needs to include this file in their project.
Please follow below steps to use this library module in your project.
struct status vUARTIntStatus This structure contains error and status flags.
unsigned char This function returns the number of bytes of free space
UARTIntGetTxBufferEmptySpace(void) left out in transmit buffer at the calling time of this func-
tion. It helps
the user to further write data in to transmit buffer at
once, rather than checking transmit buffer is full or not
with every addition of data in to the transmit buffer.
Preconditions None
Input None
Output None
Overview This is the Interrupt service routine which is called in the user application's
ISR portion.This function actually sends the data from
transmit buffer to USART and updates the data count and read pointer
variables of transmit buffer. For the receive portion, it reads the data from
USART and places the data in to receive buffer (if no errors occured) and
updates data count and write pointer variables of receive buffer.
Input None
Output None
Overview This function reads the data from the receive buffer. It places the data in to
argument and updates the data count and read pointer variables of
receive buffer.
Overview This function puts the data in to transmit buffer. Internal implementation
wise , it places the argument data in transmit buffer and updates the data
count and write pointer variables.
Overview This function returns the number of bytes of free space left out in transmit
buffer at the calling time of this function. It helps the user to further write
data in to transmit buffer at once, rather than checking transmit buffer is
full or not with every addition of data in to the transmit buffer.
Input None
Overview This function returns the number of bytes of data available in receive
buffer at the calling time of this function. It helps the user to read data
from receive buffer at once, rather than checking receive buffer is empty or
not with every read of data from receive buffer.
Input None
Macro mDisableUARTTxInt()
Input None
Output None
Macro mEnableUARTTxInt()
Input None
Output None
Macro mDisableUARTRxInt()
Input None
Output None
Input None
Output None
Macro mSetUARTRxIntHighPrior()
Input None
Output None
Macro mSetUARTRxIntLowPrior()
Input None
Output None
Input None
Output None
Macro mSetUARTTxIntLowPrior()
Input None
Output None
Macro mSetUART_BRGHHigh()
Input None
Output None
Input None
Output None
Macro mSetUART_SPBRG(iBRGValue)
Overview Sets the SPBRG register value to the argument value passed.
Input None
Output None
Macro mSetUARTBaud(iBaudRate)
Overview Sets the baud rate of UART to the argument value passed.
Input None
Output None
All errors/status are set as a bit flag in structure variable named UARTIntStatus. Individual bit
flag indicates different errors. Please refer below list for the information.
UARTIntTxBufferFull This bit is set when transmit buffer is full. When data gets
tranmitted it is cleared.
UARTIntTxBufferEmpty It is set when transmit buffer is empty. If any item is present in the
buffer this bit is cleared
UARTIntRxBufferEmpty It is set when receive buffer is empty. If any item is received its
cleared.
UARTIntRxOverFlow It indicates receive buffer is full and UART is still receiving the data.
It indicates in between data is missing. It gets cleared once the
receive buffer is being read.