Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 10, 2005 08:04:01

v.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] sdram adress/length


 hello all,i am using avr-gcc (GCC) 3.4.3, and using ATmega16
,and writng the code for copying sdram data int
flash, in c language.There are three address bytes and three length
bytes for sdram.At a time i can read 16 bytes from sdram, then i
want to decerment the length and incerement the address value bye
16.how to increment address value(or decrement the
length), by using a single variable.i dont want use three different bytes, because then
 propogating carry  becomes a problem..is there any way , by which we can define a data
type which takes three bytes of memory...? or how can i solve this problem?     regards,varsha--***********************Confidentiality Notice***************************The information contained in this electronic message and any attachmentsto this message are intended for the exclusive use of the addressee(s)and may contain confidential or privileged information. If you are notthe intended recipient, please notify the sender at Divinet or immediately and destroy all copies of thismessage and any attachments.************************************************************************_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#2 Nov. 10, 2005 14:44:38

Dave H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] sdram adress/length


From: "varsha" <>hello all,
i am using avr-gcc (GCC) 3.4.3, and using ATmega16 ,
and writng the code for copying sdram data int flash, in c language.
There are three address bytes and three length bytes for sdram.At a time i can read 16 bytes from sdram, then i want to decerment thelength and incerement the address value bye 16.how to increment address value(or decrement the length), by using a singlevariable.i dont want use three different bytes, because then propogating carrybecomes a problem..is there any way , by which we can define a data type which takes threebytes of memory...?Obviously, you could use unsigned long, which solves all your problems atthe cost of one unused byte. Each.unsigned long sdram_adr = 0;
unsigned long sdram_len = 0x1000000;

while (sdram_len >0)
{
process_16_sdram_bytes(sdram_adr);
sdram_len -= 16;
sdram_adr += 16;
}However, access to unsigned long is not atomic. If you are going to beaccessing these values in interrupt service routines, you'll have to protectaccess in mainline code so they aren't interrupted.Hope this helps,
-=Dave




_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#3 Nov. 10, 2005 15:02:31

David B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] sdram adress/length


(Please post in plain text format, not tiny font html)


You can use "unsigned long int" (or uint32_t) for 32-bit unsigned integers.
I don't think there is any support for three-byte data in avr-gcc - it is
not a commonly used size in C. You'll waste a little time and space with
32-bit data, but it will save worrying about the carry.

Alternatively, and probably better, you could re-organize your loops in
terms of inner and outer loops with (at most) 16-bit counters for each.

Of course, flash write speed is by far the overhead in such a loop, not the
calculation of the increments.

And are you sure you mean sdram? I can't think of any way an sdram chip
could be connected to an AVR and still work properly. You've got to access
it synchronous to a fast clock, and refresh the data regularly.

mvh.,

David




----- Original Message -----
From: varsha



hello all,
i am using avr-gcc (GCC) 3.4.3, and using ATmega16 ,
and writng the code for copying sdram data int flash, in c language.
There are three address bytes and three length bytes for sdram.
At a time i can read 16 bytes from sdram, then i want to decerment the
length and incerement the address value bye 16.
how to increment address value(or decrement the length), by using a single
variable.
i dont want use three different bytes, because then propogating carry
becomes a problem..
is there any way , by which we can define a data type which takes three
bytes of memory...?

or how can i solve this problem?


regards,
varsha

--





_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support