Datasheet
UART LIBRARY
UART hardware module is available with a number of AVR MCUs. mikroC PRO for
AVR UART Library provides comfortable work with the Asynchronous (full duplex)
mode.
You can easily communicate with other devices via RS-232 protocol (for example
with PC, see the figure at the end of the topic – RS-232 HW connection). You need
a AVR MCU with hardware integrated UART, for example ATmega16. Then, simply
use the functions listed below.
Library Routines
- UARTx_Init
- UARTx_Init_Advanced
- UARTx_Data_Ready
- UARTx_Read
- UARTx_Read_Text
- UARTx_Write
- UARTx_Write_Text
The following routine is for the internal use by compiler only:
UARTx_TX_Idle
Note: AVR MCUs require you to specify the module you want to use. To select the
desired UART, simply change the letter x in the prototype for a number from 1 to 4.
Number of UART modules per MCU differs from chip to chip. Please, read the
appropriate datasheet before utilizing this library.
Example:
UART2_Init(); initializes UART 2 module.
Note: Some of the AVR MCUs do not support UARTx_Init_Advanced routine.
Please, refer to the appropriate datasheet.
534
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6