Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Help needed:- what's the quickest way to store 256 bytes of data?

2006-02-13 by John Samperi

At 04:26 AM 14/02/2006, you wrote:
>fastest way to go about reading a fixe number of bytes into an
>array/memory location using assembler?
>
>char mydata[256];
>void myloop()
>     {
>     for(d=256;d;d--) mydata[d]=PIND;
>     }

ldi     xl,low(mydata)
ldi     xh,high(mydata) ;use x as pointer
clr     counter         ;use any 8 bit register

cpy_loop:
in      data_reg,pind   ;use any 8 bit register for data
st      x+,data_reg     ;save data with post increment
dec     counter
brne    cpy_loop        ;exit when 8 bit counter reaches 0 again

Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

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.