Re: [AVR-Chat] Serial communication problem in atmega32
2008-03-14 by rakesh modi
Thanks for ur reply. Now i want to know that what is the fuse setting for atmega32 for uart communication? bcoz my program is working but i am getting only 100 baudrate. R.P.Modi
Show quoted textHide quoted text
----- Original Message ----
From: David Kelly <dkelly@hiwaay.net>
To: AVR-Chat@yahoogroups.com
Sent: Friday, 14 March, 2008 3:53:55 AM
Subject: Re: [AVR-Chat] Serial communication problem in atmega32
On Mar 14, 2008, at 4:22 AM, eko setiawan wrote:
> what kind of program which U use to write uC?
> try this:
> I use CV AVR. that program have provide the fitur for serial comm
> easily.
> U can use code wizard fitur in there.
> U only adjust the baud rate.
> the command for display is "printf", like command in c language.
"printf" is not a C command, it is a routine like any other,
contained in a library, described in header file(s).
printf() is usually a very large consumer of CPU resources as it must
include a runtime interpreter to read the format string, then it must
include binary to ASCII converters for all supported output formats
whether you use them or not.
In general only very large projects, students or other novices, can
afford the cost of printf() in an embedded environment.
What most of us do is write routines that do just what we want and
nothing else. Maybe a putchar() to write individual bytes out the
serial port. Then puts() to repeatedly call putchar() writing each
character of a string. Then i8puts() to convert an 8 bit integer and
write to the serial port in ASCII, and/or u8puts(), or u16puts(), and/
or i16puts(), ... And often I add crlf() for line endings.
void crlf(void)
{
putchar(0x0d) ;
putchar(0x0a) ;
}
and use something like this:
puts("The answer is ");
i16puts(sum) ;
crlf();
rather than
printf("The answer is %i\n", sum);
--
David Kelly N4HHE, dkelly@HiWAAY. net
============ ========= ========= ========= ========= ========= ========= ======
Whom computers would destroy, they must first drive mad.
<!--