Datasheet
Library Example
The example demonstrates a simple data exchange via UART. When AVR MCU
receives data, it immediately sends it back. If AVR is connected to the PC (see the
figure below), you can test the example from the mikroC PRO for AVR terminal for
RS-232 communication, menu choice Tools › Terminal.
char uart_rd;
void main() {
UART1_Init(9600); // initialize UART module at 9600 bps
Delay_ms(100); // wait for UART module to stabilize
while (1) { // endless loop
if (UART1_Data_Ready()) { // if data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
}
}
}
540
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6