Searching \ for '[PIC]: cblock' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'cblock'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: cblock'
2002\05\02@073851 by Howard Simpson

flavicon
face
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
---------------------
fa should be stored at addr    (0x50)
fb stored at the next address  (0x51)
fc stored at the next address  (0x52)

I think that fsr would be loaded with 0x50 at line 5, and can be
incremented (or decremented) from there.
Doesn't seem to work.  I may have another error not related to the above
lines somewhere, but before I look more diligently, I'd like to be sure
that it should work!
Regards
Howard.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\05\02@080401 by Bob Ammerman

picon face
FSR is like any other register. If you want it to have a particular value,
you have to put it there:

   movlw    addr        ; get address of 'addr' into W
   movwf    FSR        ; and put it in FSR

   movlw    0xFA
   movwf    INDF     ; put 0xFA into 'addr' (@ 0x50)

   incf        FSR,f
   movlw    0xFB
   movwf    INDF     ; put 0xFB into 'addr+1' (@51)

   etc.

But for this case you could simply:

   movlw    0xFA
   movwf    addr            ; put 0xFA into 'addr'
   movlw    0xFB
   movwf    addr+1        ; put 0xFB into 'addr+1' (@51)

Bob Ammerman
RAm Systems


{Original Message removed}

2002\05\02@080415 by Alan B. Pearce

face picon face
>I think that fsr would be loaded with 0x50 at line 5, and can be
>incremented (or decremented) from there.
>Doesn't seem to work.  I may have another error not related to the above
>lines somewhere, but before I look more diligently, I'd like to be sure
>that it should work!
>Regards
>Howard.

No instead at line 5 you should have
5       movwf   fsr    ;copy to the variable named in cblock
               ^^^^
to explicitly load the FSR

and then to access the required register you need

8       movwf   0x00    ;and to the address in fsr

as you have written, but to show your intent, you should use the mnemonic
INDF instead of 0x00.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\05\03@064018 by Howard Simpson

flavicon
face
Howard Simpson wrote:
{Quote hidden}

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.
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.
Thanks all for replying
Howard.

--
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


2002\05\03@074335 by Byron A Jeff

face picon face
On Fri, May 03, 2002 at 08:03:50PM +1000, Howard Simpson wrote:
{Quote hidden}

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


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...