Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
UARTx_Data_Ready
UARTx_Read
472
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function UARTx_Data_Ready() as byte
Returns
Function returns 
1
if data is ready or
0
if there is no data.
Description
The function tests if data in receive buffer is ready for reading.
Requires
MCU with the UART module.
The UART module must be initialized before using this routine. See the
UARTx_Init routine.
Example
dim receive as byte
...
' read data if ready
if (UART1_Data_Ready() = 1) then
receive = UART1_Read()
Prototype
sub function UARTx_Read() as byte
Returns
Received byte.
Description
The function receives a byte via UART. Use the UARTx_Data_Ready function to
test if data is ready first.
Requires
MCU with the UART module.
The UART module must be initialized before using this routine. See UARTx_Init
routine.
Example
dim receive as byte
...
' read data if ready
if (UART1_Data_Ready() = 1) then
receive = UART1_Read()