Searching \ for 'How to move BLOCK in PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'How to move BLOCK in PIC'.

Truncated match.
PICList Thread
'How to move BLOCK in PIC'
1998\01\08@102519 by zhuxh

flavicon
face
Hi, friends on Piclist,

       I am a newbie in PIC programming, now I have encountered
a problem in my project. I just wanted to move data in ram from
one block to another, but I found it quite difficult to do this in
P16C5x. Do you have any suggestion? Sample codes are welcome!

       Thanks in advance!

1998\01\08@115156 by Mike Keitz

picon face
On Thu, 8 Jan 1998 23:24:41 +0800 Starfire Zhu <spam_OUTzhuxhTakeThisOuTspamcheerful.com>
writes:
>Hi, friends on Piclist,
>
>        I am a newbie in PIC programming, now I have encountered
>a problem in my project. I just wanted to move data in ram from
>one block to another, but I found it quite difficult to do this in
>P16C5x.

It is difficult to do a general move between two arbitrary blocks, since
there is only one FSR.  If the blocks are rather small and one is always
in the same place, consider directly accessing that one and indirectly
accessing the other.

A general block move can be done by realizing that the two addreses in
RAM are always the same distance apart.  Here's a quickly written version
which may not be optimum but it should work.

;Enter here with dist = address of dest - address of src, FSR =
;  address of src, and bc = number of bytes to move.
movelp
       movfw   INDF            ;Read a source byte.
       xorwf   dist,w          ;Exchage values in W and dist.
       xorwf   dist,f
       xorwf   dist,w          ;Now w=dist, dist = data.
       addwf   FSR,f           ;Adjust pointer to
destination.
       xorwf   dist,w          ;Exchange values back.
       xorwf   dist,f
       xorwf   dist,w
       movwf   INDF            ;Store destination data.
       decf    dist,w          ;Get dist-1 to W
       subwf   FSR,f           ;FSR = old source val + 1
       decfsz  bc,f
       goto    movelp

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