On a PIC, the FSR is the equivalent of an index register. Point it to the location you want to read or write, then read or write indf . The "pointed to" location will be read or written. The 18f series has several fsr registers. There are also registers that pre and post increment and decrement, doing some of the work for you. Harold > Hi > > I'm using PIC16F628A. > > I've been wondering how would you move along a buffer/array, reading or > writing to each location in a loop? I can't see any obvious indirect > memory > access instructions in the reference manual. > > In my old 6502/'6510 assembler days I'd do something like (IIRC); > LDA #0 > LDX #5 > loop: > STA buffer_start,X > DEX > BNE loop > .... > > Obviously, PIC only has the W register, and doesn't have index > registers...Is > there some 16-bit address to set, and some indirect instruction or > something? > > cheers, > Mark > > ============================================================================== > This message is for the sole use of the intended recipient. If you > received > this message in error please delete it and notify us. If this message was > misdirected, CSFB does not waive any confidentiality or privilege. CSFB > retains and monitors electronic communications sent through its network. > Instructions transmitted over this system are not binding on CSFB until > they > are confirmed by us. Message transmission is not guaranteed to be secure. > ============================================================================== > > _______________________________________________ > http://www.piclist.com > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- FCC Rules Online at http://www.hallikainen.com _______________________________________________ http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist