User manual
mikroPascal PRO for PIC32
MikroElektronika
553
UARTx_Init
Prototype
procedure UARTx_Init(baud_rate : dword);
Description Congures and initializes the UART module.
The internal UART module module is set to:
- continue operation in IDLE mode
- default Tx and Rx pins
- loopback mode disabled
- 8-bit data, no parity
- 1 STOP bit
- transmitter enabled
- generate interrupt on transmission end
- interrupt on reception enabled
- Address Detect mode disabled
Parameters - baud_rate: requested baud rate
Returns Nothing.
Requires Routine requires the UART module.
Example
// Initialize hardware UART1 module and establish communication at 2400
bps
UART1_Init(2400);
Notes - Refer to the device data sheet for baud rates allowed for specic Fosc.
- The compiler will choose for which speed the calculation is to be performed (high or low). This does
not mean that it is the best choice for desired baud rate.
If the baud rate error generated in this way is too big then UARTx_Init_Advanced routine, which
allows speed select be used.
- UART library routines require you to specify the module you want to use. To select the desired
UART module, simply change the letter x in the routine prototype for a number from 1 to 6.
- Switching between the UART modules in the UART library is done by the UART_Set_Active
function (UART modules have to be previously initialized).
- Number of UART modules per MCU differs from chip to chip. Please, read the appropriate
datasheet before utilizing this library.










