sathiieesh
Newbie level 5
Hi..
I am interfacing 89c51 microcontroller with PC using UART... when i used the code below.. i can used to send and receive the messages in hyperterminal but its not the actual message.. for example if i send Z from PC, microcontroller returns it back by [ ... if i send w from PC , microcontroller returns back by sending u ... what might be the problem.. i also checked it for different baud rates.... i have used max232 ic in between microcontroller and rs232...
Compiler:MikroC for 8051
please check it...
Sathiesh Kumar.V
I am interfacing 89c51 microcontroller with PC using UART... when i used the code below.. i can used to send and receive the messages in hyperterminal but its not the actual message.. for example if i send Z from PC, microcontroller returns it back by [ ... if i send w from PC , microcontroller returns back by sending u ... what might be the problem.. i also checked it for different baud rates.... i have used max232 ic in between microcontroller and rs232...
Compiler:MikroC for 8051
please check it...
Code:
char uart_rd;
void main() {
UART1_Init(4800); // Initialize UART module at 4800 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text("Start");
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
}
}
}
Sathiesh Kumar.V