>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >On Behalf Of Mcgee, Mark >Sent: 18 October 2004 13:05 >To: 'piclist@mit.edu' >Subject: [PIC]Stepping through buffer in assembler? > > >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 Indirect addressing is performed using the INDF and FSR regsiters. You put the address in the FSR register and then use the INDF register to read or write the location as usual. You can then perform any indexing math you require on the FSR register. Note that the FSR register can address only 256 bytes (two banks). For devices with more than two banks of RAM you use the IRP bit in the STATUS register as the bit of the address. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist