mikroC
making it simple...
Library Example
mikroC - C Compiler for Microchip PIC microcontrollers
The example demonstrates simple data exchange via software UART. When PIC MCU receives data, it immediately sends the same data back. If PIC is connected to the PC (see the figure below), you can test the example from mikroC terminal for RS232 communication, menu choice Tools > Terminal.
unsigned short data = 0, ro = 0; unsigned short *er;
void main() { er = &ro;
//Init (8 bit, 2400 baud rate, no parity bit,
do { |
|
do { |
|
data = Soft_Uart_Read(er); | // Receive data |
} while (*er); |
|
Soft_Uart_Write(data); | // Send data via UART |
} while (1); |
|
}//~! |
|
|
| page |
|
MikroElektronika: Development tools - Books - Compilers | 263 | ||
|
|