Serial communication issue

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 8-bit PIC MCUs.
Post Reply
Author
Message
mrlee
Posts: 3
Joined: 21 Nov 2018 04:08

Serial communication issue

#1 Post by mrlee » 21 Nov 2018 04:37

I am new in PIC. I am trying all test codes. I have tested LCD,LED,Stepper,servo motor successfully, while testing serial i am getting garbage value. I am using PIC16F877a, 20Mhz, USB to serial communication converter. Kindly help me. Thanks you.

code:
char i ;
void main() {
UART1_Init(19200); // Initialize USART module
// (8 bit, 19200 baud rate, no parity bit...)
delay_ms(2000);
UART1_Write_Text("Hello world!");
UART1_Write(13); // Start a new line
UART1_Write(10);
UART1_Write_Text("PIC16F877A UART example");
UART1_Write(13); // Start a new line
UART1_Write(10);
while (1) {
if (UART1_Data_Ready()) { // If data has been received
i = UART1_Read(); // read it
UART1_Write(i); // and send it back
}
}
}

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Serial communication issue

#2 Post by filip » 30 Nov 2018 09:23

Hi,

I believe I have answered you on the other post.

Regards,
Filip.

Post Reply

Return to “PIC PRO Compilers”