Usart Library - mikroElektronika PIC Microcontrollers PIC12 User Manual

Mikroc user's manual
Table of Contents

Advertisement

mikroC
making it simple...

USART Library

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.
Library Routines
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_Init
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
Requires
You need PIC MCU with hardware USART.
Example
Usart_Init(2400);
MikroElektronika: Development tools - Books - Compilers
mikroC - C Compiler for Microchip PIC microcontrollers
Usart_Write2();
needs to be called before using other functions from USART Library.
// Establish communication at 2400 bps
page
271

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents