Mikroelektronika MIKROE-350 データシート

ページ / 526
UARTx_Init_Advanced
471
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure UARTx_Init_Advanced(dim baud_rate as longworddim
parity 
as bytedim stop_bits as byte)
Returns
Nothing.
Description
Configures and initializes UART module.
Parameter 
baud_rate
configures UART module to work on a requested baud rate. 
Parameters 
parity
and 
stop_bits
determine the work mode for UART, and
can have the following values:
Note: Some MCUs do not support advanced configuration of the UART module.
Please consult appropriate daatsheet. 
Requires
MCU must have UART module.
Example
' Initialize hardware UART1 module and establish communication at
9600 bps, 8-bit data, even parity and 2 STOP bits 
UART1_Init_Advanced(9600, _UART_EVENPARITY, _UART_TWO_STOPBITS)
Mask
Description
Predefined library const
Parity constants:
0x00
Parity mode disabled
_UART_NOPARITY
0x20
Even parity
_UART_EVENPARITY
0x30
Odd parity
_UART_ODDPARITY
Stop bit constants:
0x00
1 stop bit
_UART_ONE_STOPBIT
0x01
2 stop bits
_UART_TWO_STOPBITS