problem in uart communication!!!
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
problem in uart communication!!!
I followed UART library and done every thing as mentioned in library file including connections...
i using ATMEGA16A and 8Mhz crystal, but i cant communicate with pc....
wat ever i entered in the screen and transmitted it should be back,but the reply is always something like EEEEEEEEEEE....... what is my mistake?
how to communicate with pc using uart(rx and tx).
and when ever i build a program it shows Generated baud rate is 9615 bps (error = 0.16 percent)
how to generate accurate 9600 bps , help me........
i using ATMEGA16A and 8Mhz crystal, but i cant communicate with pc....
wat ever i entered in the screen and transmitted it should be back,but the reply is always something like EEEEEEEEEEE....... what is my mistake?
how to communicate with pc using uart(rx and tx).
and when ever i build a program it shows Generated baud rate is 9615 bps (error = 0.16 percent)
how to generate accurate 9600 bps , help me........
Re: problem in uart communication!!!
Hi,
How did you connect the ATmega16A ?
Do you have some custom board ?
Did you enter the proper oscillator value and set the appropriate baud rate in the Terminal window that you use ?
Regards,
Filip.
How did you connect the ATmega16A ?
Do you have some custom board ?
Did you enter the proper oscillator value and set the appropriate baud rate in the Terminal window that you use ?
Regards,
Filip.
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
Hi, i followed inbuild library file instructions(for program and circuit)...
and also i tried communication between atmega16a to atmega16a with 4Mhz crystal,its working good..
but when i try to communicate with pc it shows error, so i change to 8Mhz crystal as mentioned in library file,anyway it showing the same error as EEEEEEE for all the data send by ATMEGA16A...
and iam not using any board, i simply followed the circuit gave in library file....
Generated baud rate is 9615 bps (error = 0.16 percent) is the error showing always....
i planned to communicate with gsm mobule sim300 and also to gps,because of the baud rate problem i cant communicate, help me to generate accurate baudrate...
first try to solve my problem with basic communication with pc,then i wil try with other modules...
and also i tried communication between atmega16a to atmega16a with 4Mhz crystal,its working good..
but when i try to communicate with pc it shows error, so i change to 8Mhz crystal as mentioned in library file,anyway it showing the same error as EEEEEEE for all the data send by ATMEGA16A...
and iam not using any board, i simply followed the circuit gave in library file....
Generated baud rate is 9615 bps (error = 0.16 percent) is the error showing always....
i planned to communicate with gsm mobule sim300 and also to gps,because of the baud rate problem i cant communicate, help me to generate accurate baudrate...
first try to solve my problem with basic communication with pc,then i wil try with other modules...
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
i set crystal value in project setting tab and 9600 baud rate is set by using the program as mentioned below
char uart_rd;
void main() {
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text("Init");
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
}
}
}
in last message u mentioned something like terminal window, wat is that i cant undersand,can u tell clearly pls...
but i just build program mentioned in library file,without adding anything...
is there anything to add other than above mentioned program...
char uart_rd;
void main() {
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text("Init");
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
}
}
}
in last message u mentioned something like terminal window, wat is that i cant undersand,can u tell clearly pls...
but i just build program mentioned in library file,without adding anything...
is there anything to add other than above mentioned program...
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
Mr.Filip try to solve my problem,
Pls tell me, how to generate accurate 9600 bps using 4MHZ crystal with mikroc pro compiler
Pls tell me, how to generate accurate 9600 bps using 4MHZ crystal with mikroc pro compiler
Re: problem in uart communication!!!
it may be your project settings in compiler... is it 4 MHz ?
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
Ya I kept 4Mhz in then y I can't communicate
Re: problem in uart communication!!!
Hi,
You said that :
Which hardware did you use ?
Did you use any UART terminal and did you set it properly ?
Regards,
Filip.
You said that :
How did you connect it to the PC ?and also i tried communication between atmega16a to atmega16a with 4Mhz crystal,its working good..
but when i try to communicate with pc it shows error, so i change to 8Mhz crystal as mentioned in library file,anyway it showing the same error as EEEEEEE for all the data send by ATMEGA16A...
and iam not using any board, i simply followed the circuit gave in library file....
Which hardware did you use ?
Did you use any UART terminal and did you set it properly ?
Regards,
Filip.
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
i followed the below circuit with 4Mhz crystal and i used in built USART terminal in mikroc pro...
settings r 9600 bps, 1stop bit, 8 databits,no parity,buffer size 1024,flow control-none...
settings r 9600 bps, 1stop bit, 8 databits,no parity,buffer size 1024,flow control-none...
- Attachments
-
- serial.JPG (50.3 KiB) Viewed 7492 times
Last edited by n_vikranth on 19 Feb 2012 11:19, edited 1 time in total.
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
Generated baud rate is 9615 bps (error = 0.16 percent) is the error showing always....
this can be a problem r not....
How to generate accurate baudrate?????
This is my error reply from pc=€€øøøøøø€øøø€ø€øø€€øø€€øø€€øø€€øø€€€ø€€ø€€ø€€ø€€ø€€ø€€ø€
for all data send from ATMEGA16A......
this can be a problem r not....
How to generate accurate baudrate?????
This is my error reply from pc=€€øøøøøø€øøø€ø€øø€€øø€€øø€€øø€€øø€€€ø€€ø€€ø€€ø€€ø€€ø€€ø€
for all data send from ATMEGA16A......
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
I used 4Mhz crystal as shown in below picture, wat are the setting to be changed in project window shown below, I think setting may be problem.... atleast help me to set the correct settings, because of uart communication i feel bad on Mikroelectronika....
other than uart, mikroc pro working very good... so solve my little problem,soon...
My all current projects are delayed because of uart communication,so answer me...
r else, FILIP tell me at wat time u wil be in online... then i can easily discuss with u, about my doubts....
other than uart, mikroc pro working very good... so solve my little problem,soon...
My all current projects are delayed because of uart communication,so answer me...
r else, FILIP tell me at wat time u wil be in online... then i can easily discuss with u, about my doubts....
- Attachments
-
- crystal.JPG (2.37 KiB) Viewed 7493 times
-
- settings.JPG (48.04 KiB) Viewed 7493 times
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
Mr.FILIP I gav all details about my ciruit, then y u r waiting for reply....
Help me,pls.....
Help me,pls.....
Re: problem in uart communication!!!
Hi,
Please, can you attach here your project ?
Regards,
Filip.
Please, can you attach here your project ?
Regards,
Filip.
-
- Posts: 35
- Joined: 11 Jan 2012 15:06
Re: problem in uart communication!!!
project file attached,pls fuse this simple program in ATMEGA16A and use 4Mhz crystal as a oscillator(with 22pf) as shown in above circuit and solve the problem & reply me the solution soon...
- Attachments
-
- UART.rar
- (32.21 KiB) Downloaded 257 times
Re: problem in uart communication!!!
Hi,
Please, see in the following schematic (page 4) how we have utilized the oscillator circuit (it applies to all of our boards that can handle ATmega16) :
http://www.mikroe.com/eng/downloads/get ... l_v100.pdf
Try it and inform me of the results.
Regards,
Filip.
Please, see in the following schematic (page 4) how we have utilized the oscillator circuit (it applies to all of our boards that can handle ATmega16) :
http://www.mikroe.com/eng/downloads/get ... l_v100.pdf
Try it and inform me of the results.
Regards,
Filip.