ABL electronic PIC16 Personal Computer User Manual


 
USART hardware module is available with a number of PICmicros. mikroC
USART Library provides comfortable work with the Asynchronous (full duplex)
mode.You can easily communicate with other devices via RS232 protocol (for
example with PC, see the figure at the end of the topic – RS232 HW connection).
You need a PIC MCU with hardware integrated USART, for example PIC16F877.
Then, simply use the functions listed below.
Note: USART library functions support module on PORTB, PORTC, or PORTG,
and will not work with modules on other ports. Examples for PICmicros with
module on other ports can be found in “Examples” in mikroC installation folder.
Usart_Init
Usart_Data_Ready
Usart_Read
Usart_Write
Note: Certain PICmicros with two USART modules, such as P18F8520, require
you to specify the module you want to use. Simply append the number 1 or 2 to a
function name. For example,
Usart_Write2();
MikroElektronika:
Development
tools
-
Books
-
Compilers
27 1
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
USART Library
Library Routines
Prototype
void Usart_Init(const long baud_rate);
Description Initializes hardware USART module with the desired baud rate. Refer to the device data
sheet for baud rates allowed for specific Fosc. If you specify the unsupported baud rate,
compiler will report an error.
Usart_Init needs to be called before using other functions from USART Library.
Requires You need PIC MCU with hardware USART.
Example
Usart_Init(2400);
// Establish communication at 2400 bps
Usart_Init