Mikroelektronika MIKROE-350 データシート
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
UARTx_Write
UARTx_Write_Text
474
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure UARTx_Write(dim TxData as byte)
Returns
Nothing.
Description
The function transmits a byte via the UART module.
Parameters :
-
TxData:
data to be sent
Requires
MCU with the UART module.
The UART module must be initialized before using this routine. See UARTx_Init
routine.
routine.
Example
dim data_ as byte
...
...
data_ = 0x1E
UART1_Write(data_)
UART1_Write(data_)
Prototype
sub procedure UARTx_Write_Text(dim byref uart_text as
string[255])
string[255])
Returns
Nothing.
Description
Sends text (parameter uart_text) via UART. Text should be zero terminated.
Requires
UART HW module must be initialized and communication established before
using this function. See UARTx_Init.
using this function. See UARTx_Init.
Example
Read text until the sequence “OK” is received, and send back what’s been received:
UART1_Init(4800) ' initialize UART
module
Delay_ms(100)
Delay_ms(100)
while TRUE
if (UART1_Data_Ready() = 1) ' if data is received
UART1_Read_Text(output, 'delim', 10) ' reads text until
'delim' is found
UART1_Write_Text(output) ' sends back text
end if
wend.