Mikroelektronika MIKROE-350 Datenbogen

Seite von 526
Library Example
This example demonstrates simple data exchange via UART. If MCU is connected
to the PC, you can test the example from the mikroBasic PRO for AVR USART Ter-
minal.
program UART
dim uart_rd as byte
main:
UART1_Init(19200)      ' Initialize UART module at 9600 bps
Delay_ms(100)          ' Wait for UART module to stabilize
while TRUE                               ' Endless loop
if (UART1_Data_Ready() <> 0) then
' If data is received,
uart_rd = UART1_Read()    '   read the received data,
UART1_Write(uart_rd)      '   and send data via UART
end if
wend
end.
HW Connection
UART HW connection
475
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6