User`s manual
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
USART (Universal Synchronous Asynchronous Receiver Transmitter) hardware
module is available with a number of PIC MCU models. Set of library procedures
and functions is listed below to provide 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 this chapter - RS232 HW connection). You
need a PIC MCU with hardware integrated USART (for example, PIC16F877).
Then, simply use the functions and procedures described below.
Note that these functions and procedures support module on PORTC or PORTG,
and won't work with modules on other ports. Examples for PIC MCUs with mod-
ule on other ports can be found in your mikroBasic installation folder, subfolder
'examples'.
sub procedure USART_Init(const Baud_Rate)
sub function USART_Data_Ready as byte
sub function USART_Read as byte
sub procedure USART_Write(dim Data as byte)
Certain PIC MCU models 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
procedure or function name - for example, USART_Write2(dim Data as byte).
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
161
page
USART Library
Note
Routines