Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] USART

2009-09-23 by David Kelly

On Wed, Sep 23, 2009 at 12:17:34PM -0300, Emerson Santos wrote:
> Hi people ...
> 
> I?m a newbie in AVR USART , and i have a problem that i can
> understand.. I make a code below
> 
> ...
> 
> #asm("SEI");
> 
> main
> while (1)
>       {
> 
>        WR_SERIAL(0x04);
> 
>       };
> }
> 
> ....

[...]

> My problem is that the interruption is working if i run my program
> with JTAG e AVRSTUdio (I run in a ATmega32) in steoping mode... but
> out the AVRStudio .. nothing happening the TX is working all time and
> not have a stop that i like.

Why is #asm("SEI"); sitting outside of main()? I don't recognize the
language used above for main() while the rest of the code appears to be
C. User code execution starts at main() so your SEI should be after the
entry point to main().

If using avr-gcc one can:

#include <avr/interrupt.h>

main()
{
	sei();
	while(1) {
		WR_SERIAL( 0x04 );
	}
}

-- 
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.