uart write problams

General discussion on mikroElektronika website & forums.
Post Reply
Author
Message
matanb
Posts: 3
Joined: 01 Feb 2017 14:49

uart write problams

#1 Post by matanb » 16 Feb 2017 13:02

hello
i have problem with my ready for pic(pic18) and maybe you can help me.
i have problam with the uart on my pic, i tried many ways to recive code on uart and check it on uart terminal but it didn't work.
with all of my codes i didn't recive any code and with the example code (showen below):

char uart_rd;

void main() {
ANSELC = 0; // Configure PORTC pins as digital

UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize

UART1_Write_Text("Start");
UART1_Write(13);
UART1_Write(10);

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
}
}
}


i only recive:" StStSt.... " that doesn't stop.
can someone help me understand the problam?
thank u

User avatar
danilo.milovic
mikroElektronika team
Posts: 501
Joined: 05 Dec 2016 14:59

Re: uart write problams

#2 Post by danilo.milovic » 20 Feb 2017 14:45

Hi,

what mcu are you using? Make sure you've selected correct baud rate (9600) and appropriate com port.

If I'm not mistaking this is example code for UART and it should work.

Regards,

Danilo

Post Reply

Return to “Website & Forums General Discussion”