>From: Drew Vassallo <
spam_OUTsnurpleTakeThisOuT
HOTMAIL.COM>
>Reply-To: pic microcontroller discussion list <
.....PICLISTKILLspam
@spam@MITVMA.MIT.EDU>
>To:
PICLIST
KILLspamMITVMA.MIT.EDU
>Subject: Re: [PIC]: Memory Block Copy for PIC16F877
>Date: Wed, 18 Apr 2001 13:03:17 -0400
>
>>If no, is there any way to copy the whole memory block or I have to do the
>>following:
>>
>> movf x, w ; assume I am in bank 0
>>
>> bank1 ; switch to bank 1
>> movwf y ; store it
>>
>> bank2 ; switch to bank 2
>> movwf z ; store it
>>
>> bank4 ; switch to bank 3
>> movwf zzz ; store it
>
>No, there's no way to expand the memory range. However, you can just use
>the FSR to transfer data across memory banks. A simple way is to set up
>your variables so that they are in consecutive address locations.
>cblock 0x20
>x
>y
>z
>zzz
>endc
>
>movlw y
>movwf FSR ; load FSR with first storage address
>movf x, W ; load data to store
>movwf INDF ; store in y
>incf FSR, F
>movwf INDF ; store in z
>incf FSR, F
>movwf INDF ; store in zzz
>
>
>This might be a few instructions better than your initial method, as your
>bank switching probably requires two instructions (I don't know what your
>macros look like) while 'incf FSR, F' always takes one instruction. If you
>want to copy a larger block of memory values, you can always just put the
>"incf, FSR" and "movwf INDF" into a loop and check for the last address to
>overflow.
>
>I'm not sure, but I think most of the datasheets for PICs that have EEPROM
>memory will show you an example of this sort of thing.
>
>--Andrew
>_________________________________________________________________
>Get your FREE download of MSN Explorer at
http://explorer.msn.com
>
>--
>
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
>
>