Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Library Example
This example demonstrates simple data exchange via UART. If MCU is connected to the
PC, you can test the example from the mikroPascal PRO for AVR USART Terminal.
program UART;
var uart_rd : byte;
begin
UART1_Init(9600);            // Initialize UART module at 9600 bps
Delay_ms(100);              // Wait for UART module to stabilize
while (TRUE) do 
// Endless loop
begin
if (UART1_Data_Ready() <> 0) then
// If data is received,
begin
uart_rd := UART1_Read();      //   read the received data,
UART1_Write(uart_rd);       //   and send data via UART
end;
end;
end.
482
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6