mikroC
making it simple...
Usart_Write
Prototype
char Usart_Write(char data);
Description
Function transmits a byte (
Requires
USART HW module must be initialized and communication established before using
this function. See
Example
int chunk;
...
Usart_Write(chunk);
Library Example
The example demonstrates simple data exchange via USART. 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 i;
void main() {
// Initialize USART module (8 bit, 2400 baud rate, no parity bit..)
Usart_Init(2400);
do {
if (Usart_Data_Ready()) {
i = Usart_Read();
Usart_Write(i);
}
} while (1);
} //~!
MikroElektronika: Development tools - Books - Compilers
mikroC - C Compiler for Microchip PIC microcontrollers
) via USART.
data
.
Usart_Init
/* send data chunk via USART */
// If data is received
// Read the received data
// Send data via USART
page
273
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?