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
}
------------------------------------
______________________________
controlSUITE software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!

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