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

New!

Thinking MCU? Think TI
Visit the new
TI MCU resource center for the latest videos and documents to help support your design efforts.

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | AVRclub | [AVR club] problem in serial communication using stk500 and atmega8515


Advertise Here

Atmel AVR Microcontroller discussion group.

[AVR club] problem in serial communication using stk500 and atmega8515 - gupta_prag123 - Sep 18 9:00:55 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.
also, i have included all the necessary Winavr directories as
util/delay.h and iom8515.h.
this program is giving no compilation error.
but while downloading, in the board 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 )