Reputation: 4385
i have a problem with pic18f452 and uart i use simplest code like that:
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
and between forever while loop i have this code
UART1_Write_Text("HELLO2");
Delay_ms(1000);
also i have in my hardware lcd module it works very fine but my received data on pc is a scrap like that
???m
i have checked all connection sothand time nothing wrong also i have changed MAX232 ic but with no luck ?!
my hardware is like that
finall all my connections are ok (polarity and every thing else ?) EDIT : i use mikroc as a compiler
Upvotes: 0
Views: 2016
Reputation: 535
It happens when you have loose connections i.e. from max 232 to Pic & from max 232 to PC. Try checking the fluctuations over the transmit pin or usr Oscilloscope to see the ASCII values of Hello World alphabets.
Upvotes: 0
Reputation: 2434
Looks like a baud rate error. Have you checked that your oscillator settings are resulting in the expected frequency? Does the serial library you are using expect a certain clock frequency and you are sure that you are running at that frequency, or does it work over a set of frequencies and you have correctly informed the serial library what frequency you are using? Also it would be useful to see the byte received as a decimal or hex number rather than just ASCII.
Upvotes: 2
Reputation: 20664
What about the start bits, number of data bits, parity, and stop bits? Are they the same on both ends?
Upvotes: 0