Sign in

username:

password:



Not a member?

Search avrclub



Search tips

Subscribe to avrclub



avrclub by Keywords

AT90S2313 | AT90S8515 | ATMega | ATmega128 | ECL | FETS | IAR | Keyboard | LCD | STK50 | TMOS | UART

Sponsor

controlSUITE™ software
Comprehensive.
Intuitive.
Optimized.

Real-world software for real-time control. Details Here!

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | AVRclub | [AVR club] problem with serial communication

Atmel AVR Microcontroller discussion group.

[AVR club] problem with serial communication - gupta_prag123 - Sep 20 7:48:23 2008

Hello,

i am trying a simple Serial communication C program using stk500
with atmega 8515 device.
In AVR Studio project option,i have selected device as atmega8515
and freq 8MHz.
this program is giving no compilation error.
but after downloading,it is giving some random characters on
hyperterminal.
i have set 9600 baud rate in hyperterminal.
the program is attatched herewith.
Please help me.. i am new to the microcontroller world.

#include
#include
void USART_Init(void);
void main(void)
{
unsigned char z;
unsigned char Name[]="HELLO WORLD";
USART_Init();
while(1)
{
while((UCSRA & 0x20)==0x00); //wait for UDRE flag
for(z=0;z<=14;z++)
{
UDR = Name[z]; //load data to UDR for transmission
while((UCSRA & 0x40)==0x00); //wait for TXC flag.
}
_delay_ms(2000);
}
}

void USART_Init(void)
{

UBRRH = 0x00;
UBRRL = 0x23;
UCSRB = 0x08; //enable transmitter
UCSRC = 0x86;
//async, no parity, 1 stop bit,
//8 data bits
//Baud Rate initialization

}

------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )


[AVR club] Re: problem with serial communication - zainolabedin - Sep 23 15:14:12 2008

hello.
this problem is about your crystal. if you change your crystal number
to 11.9mhz or greater than 12mhz this problem may be solved
------------------------------------



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )