avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Write sequence


From: Keith Gudger
Subject: Re: [avr-chat] Write sequence
Date: Thu, 19 Jan 2006 15:01:29 -0800 (PST)

Thanks for the replies.  I tried volatile, and it did not make any
difference.

I got the tool chain from the web, and compiled it myself.  Is there
something wrong with the gcc version?  Thanks.  (I know that avr-libc and
binutils are acceptable versions.)

Keith

On Thu, 19 Jan 2006, Eric Weddington wrote:

> Keith Gudger wrote:
> > I have a macro defined:
> > 
> > #define WRITE_4BYTES(x, y) { CS_LOW \
> >             *(BASE + ((y) ))) = (INT8U) (x); \
> >             *(BASE + ((y + 1)))) = (INT8U) (x >> 8);\
> >             CS_HIGH }
> > 
> > (where BASE is defined as an 8 bit pointer with a value 0x8000 in ext
> > ram and the macros CS_LOW and CS_HIGH are predefined to set a pin lo /
> > high).
> > 
> > When assembled by avr-gcc (GCC) 3.4.5, avr-libc-1.4.2, binutils-2.16.1, I
> 
> Hmm, where'dya get the toolchain? ;-)
> 
> > get the following (for the atmega128):
> > 
> >     42f2:       31 83           std     Z+1, r19        ; 0x01
> >     42f4:       20 83           st      Z, r18
> > 
> > which means that in reality the write occurs this way:
> > 
> >  *(BASE + ((y + 1)))) = (INT8U) (x >> 8);\
> >  *(BASE + ((y) ))) = (INT8U) (x); \
> > 
> > Is there any way I can "force" the write order to be in the order I
> > specified (in C), or must I resort to assembly?  Thanks.
> > 
> 
> Would it help to declare the variable that you're writing to volatile?
> 
> -- 
> Eric Weddington
> 





reply via email to

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