I've been lurking for a while now but now I'm stuck and need help!
I want to create a data table on-the-fly by providing the data byte and an
offset from the start of the table. (i.e not a ready made table and use retlw)
In case you're confused .....
I want to write a byte of data at the first location in my table. I then
increment a register to point to the next location in my table. Therefore I
assume that indirect addressing is the answer.
I've looked at the very short program in my data book to clear a block of RAM
and this seems very similar(Section on Indirect Addressing,FSR,INDF) except it
says that I can't write to the INDF register. I assume that you can only clear
the INDF register with clrf INDF
in fact here's the program they give .....
clears RAM locations 20h -2fh
NEXT clrf INDF
btfss FSR,4 ;bit 4 indicates 16th byte I assume - '00010000'
It's probably really easy but it's got me stumped at the moment!
Neil Thomson <FTEL.CO.UK> wrote: N.Thomson
>I want to [create a lookup table in RAM]
>I've looked at the very short program in my data book to clear a block of RAM
>and this seems very similar(Section on Indirect Addressing,FSR,INDF) except
>it says that I can't write to the INDF register.
What they mean to say is that "INDF" isn't a physical register; when you write
to it, you actually write to the register pointed to by the FSR. This is
exactly what you want.
Any instruction that works on other registers will work on INDF.
Andrew Warren - ix.netcom.comfastfwd
Fast Forward Engineering, Vista, California
When indirectly addressing a register in Bank 1 do you have to set the
status, rp0 bit?
Or will the processor automatically access the appropriate register
based on the address.
no you have to set the bank bits first !
> no you have to set the bank bits first !
Mind you there is an "IRP" or Indirect Register Pointer bit reserved
for any time they happen to make a PIC with more than 256 bytes or RAM/
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...