Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
UARTx_Write
UARTx_Write_Text
481
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure UARTx_Write(TxData: 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.
Example
var data_: byte;
...
data := 0x1E
UART1_Write(data_);
Prototype
procedure UARTx_Write_Text(var uart_text : 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.
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);
while TRUE do
begin
if (UART1_Data_Ready() = 1)         // if data is received 
begin
UART1_Read_Text(output, 'delim', 10); // reads text
until 'delim' is found
UART1_Write_Text(output);           // sends back text 
end;
end.