On Fri, May 03, 2002 at 08:03:50PM +1000, Howard Simpson wrote:
{Quote hidden}> Howard Simpson wrote:
> >
> > Hi all
> > This should work, shouldn't it?
> >
> > 1 cblock 0x50 ;(or wherever)
> > 2 addr ;one variable name only
> > 3 endc ;
> > ;
> > ;
> > ;
> > 4 movlw 0xfa ;copy sample data to w
> > 5 movwf addr ;copy to the variable named in cblock
> >
> > 6 incf fsr,f ;inc fsr to the next address
> > 7 movlw 0xfb ;and copy different data to w
> > 8 movwf 0x00 ;and to the address in fsr
> >
> > 9 incf fsr,f ;inc fsr again to the next address
> > 10 movlw 0xfc ;and copy different data to w
> > 11 movwf 0x00 ;and to the address in fsr
> > ;and so on, as far as required
> > 12 end
> Hmmmmm! Pity! I was hoping fsr would be, by default, loaded with the
> address of the last accessed variable, but I'm obviously off the track.
You certainly would not want that behavior because it would make the
register pretty much useless. One of the purposes of FSR is transferring
multiple byte of data from one place to another. However if you referred to
the last addressed register, you can only transfer to itself.
> Ah well. My reason for this attempt was that I could, in development,
> name the first address of the set of addresses, and access them as
> shown, sometimes in several places in the program. Then, if I needed to
> change the location of the set of addresses for some reason (conflict
> with another set), all I had to do was change the address assigned to
> the variable in the cblock command.
All of that is still possible. You simply have to stick the starting address
into FSR before you start.
BTW the name of the register at address 0x00 is INDF. It helps to use the
symbolic names instead of the numbers.
BAJ
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics