Hi Paul, This untried, but pretty sure that I would go for: //assume that we have 16 blocks of 256 in the array... LDS r16,step //this one 0-255? LDS r17,num //this one 0-15? CLR r18 LDI r30,LOW(array) LDI r31,HIGH(array) ADD r30,r16 ADC r31,r17 LPM r18,r30 OUT PORTD,r18 /*...and can be two cycles quicker if you dedicate a permanent pointer to 'step' and 'num' sequentially in SRAM: LD r16,X LDD r17,X+1 */ John S Paul Maddox wrote: > Dear all, > > I've long been a user of C on AVRs, but now I have need for speed, and I'm > kinda stuck :-) > I have a two dimensional array, called array[16, 256], stored in flash > memory (these vaules won't change). > and what I need to do is something like this ;- > > PORTD = array[num, step] ; // C psuedo code > > The array contains only 8 bit values, but these are organised as 16 lots of > 256 bytes. > Any suggestions how, given that both 'num' and 'step' are variables held in > ram. > > Thanks in advance > Paul > > > > > > > Yahoo! Groups Links > > > > > > > >
Message
Re: [AVR-Chat] Reading from flash in Assembly
2004-12-01 by John Stiekema
Attachments
- No local attachments were found for this message.