'How to move BLOCK in PIC'
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!
|On Thu, 8 Jan 1998 23:24:41 +0800 Starfire Zhu <cheerful.com> zhuxh
>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
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.
movfw INDF ;Read a source byte.
xorwf dist,w ;Exchage values in W and dist.
xorwf dist,w ;Now w=dist, dist = data.
addwf FSR,f ;Adjust pointer to
xorwf dist,w ;Exchange values back.
movwf INDF ;Store destination data.
decf dist,w ;Get dist-1 to W
subwf FSR,f ;FSR = old source val + 1
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...