avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Using AVR Tools


From: ks_347
Subject: Re: [avr-gcc-list] Using AVR Tools
Date: Thu, 22 Jan 2004 15:07:40 -0800 (PST)

Hello,

How can I write the hex file into the microcontroller ?
I am using the STK500 kit and using ATMEGA162. When I tried to use 
AVRStudio(latest version) i got the following messages:
Reading FLASH using block mode..       OK
WARNING: FLASH contents differs from file.. FAILED!
Any suggestions on this or any alternate way to write to controller through gnu 
tools?
 
Thanks
Dan Lyke <address@hidden> wrote:
ks_347 writes:
> 1) So basically I am trying to write a simple program so that I can
> put "hi" through serial communication.


You'll want to look through the datasheet and understand all of this,
but yes, with the standard includes on the right chip (this is clipped
from some code I wrote for the AtMega8515, compiled with avr-gcc on
Debian Linux, "unstable" distribution), your code would look something
like:

// initialization
// Set up the USART for 9600,n,8,1 with 8MHz clock
UBRRH = 0;
UBRRL = 51;
UCSRA = 0;
UCSRB = (1< UCSRC = 0x80 | (1<
// pump out them characters.
while (1)
{ 
while (!(UCSRA & (1 << UDRE)));
UDR = 'h';
while (!(UCSRA & (1 << UDRE)));
UDR = 'i';
}

Dan


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]