mikroC
making it simple...
Library Example
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, non-inverted logic)
Soft_Uart_Init(&PORTB, 1, 2, 2400, 0);
do {
do {
data = Soft_Uart_Read(er);
} while (*er);
Soft_Uart_Write(data);
} while (1);
} //~!
MikroElektronika: Development tools - Books - Compilers
mikroC - C Compiler for Microchip PIC microcontrollers
// Receive data
// Send data via UART
page
263
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?