HI all,
I am new to MikroC, I need some help reg my project,
For my project, i need to read a text file which has 10 lines of data.
For eg.
January
February
March
April
May
June
July
August etc..
i need to read each line and send it via usart in one condition that,
it has to read a line .. send it via usart ... wait for an acknowledgement...then read the second line .....and send it.....
Could some one please help me with this thing....
READING A TEXT FILE LINE BY LINE AND SEND IT VIA USART
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: READING A TEXT FILE LINE BY LINE AND SEND IT VIA USART
Hello,
The example demonstrates a simple data exchange via UART.
When PIC MCU receives data, it immediately sends it back.
If PIC is connected to the PC (see the figure below),
you can test the example from the mikroC PRO for PIC terminal for RS-232 communication,
menu choice Tools › Terminal.
Here is a code (EasyPIC6 and PIC16F887):Best regards,
Losic Tihomir
The example demonstrates a simple data exchange via UART.
When PIC MCU receives data, it immediately sends it back.
If PIC is connected to the PC (see the figure below),
you can test the example from the mikroC PRO for PIC terminal for RS-232 communication,
menu choice Tools › Terminal.
Here is a code (EasyPIC6 and PIC16F887):
Code: Select all
char uart_rd;
void main() {
ANSEL = 0; // Configure AN pins as digital
ANSELH = 0;
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text("Start");
UART1_Write(10);
UART1_Write(13);
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
}
}
}
Losic Tihomir
mikroElektronika [Support team]