Yahoo Groups archive

AVR-Chat

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

Message

Re: help problem in uart

2005-07-01 by arhodes19044

If the compiler optimizes it away, then it thinks that USCRA is not 
volatile.  So.... can you declare somehow that UCSRA is volatile?

However, I have never had the problem with references to hardware 
registers being optimized away....

-Tony

--- In AVR-Chat@yahoogroups.com, "Lasse Madsen" <lasse.madsen@e...> 
wrote:
> Hi.
> 
>  
> 
> Your problem is most likely that the compiler optimizes the line
> while(!(UCSRA&(1<<UDRE))); away.
> 
>  
> 
> Try this instead.
> 
>  
> 
> while(condition=true)
> {
>   while(!(UCSRA&(1<<UDRE)))
> 
>   { 
> 
>   #asm("nop");               // or how ever your compiler accesses 
assembly
> inside C.
> 
>   }
> UDR=data
> }
> 
>  
> 
> Regards 
> 
>  
> 
> Lasse Madsen
> 
>  
> 
>  
> 
>  
> 
>   _____  
> 
> From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] 
On Behalf
> Of aswinefy2003
> Sent: 1. juli 2005 13:35
> To: AVR-Chat@yahoogroups.com
> Subject: [AVR-Chat] help problem in uart
> 
>  
> 
> i have the following code written in iccavr
> 
> 
> while(condition=true)
> {
> while(!(UCSRA&(1<<UDRE)));
> UDR=data
> //delay();
> }
> the problem is when i remove the delay()routine ,atmega32 is not 
> transmitting the correct data ,but any how transmitting some 
> garbage .Please help
> 
> 
> 
> 
> 
>   _____  
> 
> YAHOO! GROUPS LINKS 
> 
>  
> 
> *	 Visit your group "AVR-Chat 
<http://groups.yahoo.com/group/AVR-Chat>
> " on the web.
>   
> *	 To unsubscribe from this group, send an email to:
>  AVR-Chat-unsubscribe@yahoogroups.com
> <mailto:AVR-Chat-unsubscribe@yahoogroups.com?subject=Unsubscribe> 
>   
> *	 Your use of Yahoo! Groups is subject to the Yahoo!
> <http://docs.yahoo.com/info/terms/>  Terms of Service. 
> 
>  
> 
>   _____

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.