Mcgee, Mark wrote: > 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 Oh but it DOES have an index register. Read the description for the "FSR" register (0x4). Load FSR with your pointer (making sure Status bit IRP is set correctly to point the bank for the SFRs you want to address. Then address the INDF resister (0x00) to read/write your data. > there some 16-bit address to set, and some indirect instruction or something? Or something. It's 8 bits and you need to adjust the 9th bit using the status register. I believe this comes under the heading of RTFM (read the fricking manual). R _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist