Searching \ for '[PIC]: Memory Block Copy for PIC16F877' 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/memory.htm?key=memory
Search entire site for: 'Memory Block Copy for PIC16F877'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Memory Block Copy for PIC16F877'
2001\04\18@123014 by Thomas N

picon face
Hi everyone,

For the 16F877 IC, the RAM space of bank0 from 0x70 to 0x7F can be accessed
from any bank.  I love this feature!

Is there any way to expand it? If yes, would you please tell me how I can do
it?

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

If I want to expand the mirror memory to another 16 locations, it seems like
I have to write lots of code!  Any there any faster and more efficent way?

Thank a lot for all you help!
thomas


_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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


2001\04\18@124055 by David VanHorn

flavicon
face
At 04:28 PM 4/18/01 +0000, you wrote:
>Hi everyone,
>
>For the 16F877 IC, the RAM space of bank0 from 0x70 to 0x7F can be accessed
>from any bank.  I love this feature!
>
>Is there any way to expand it? If yes, would you please tell me how I can do
>it?

In the AVR, the entire ram space is accessible from any bank.
In fact there are no banks.
:)

In the Pic, you get what you get. There's no way to "expand" that.



--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

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


2001\04\18@124058 by Alan B. Pearce

face picon face
>If I want to expand the mirror memory to another 16 locations, it seems
like
>I have to write lots of code!  Any there any faster and more efficent way?

use the indirect addressing registers to access either the source or
destination, which ever is in the other bank to the one you are currently
in. If done correctly you may not even need to copy the registers between
banks.

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


2001\04\18@130317 by Drew Vassallo

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


2001\04\18@133717 by Thomas N

picon face
Thank you!  I will try this and see what happens.
Thomas


{Quote hidden}

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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


2001\04\18@171217 by Quentin

flavicon
face
Careful if you use ICD. These are also used by the debugger.
Very funny things happens if you write to it.

Quentin

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


2001\04\18@174534 by Bob Ammerman

picon face
> Careful if you use ICD. These are also used by the debugger.
> Very funny things happens if you write to it.
>
> Quentin

Write to what? The FSR? I do that all the time when debugging on ICD.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

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


2001\04\18@180619 by Olin Lathrop

face picon face
> For the 16F877 IC, the RAM space of bank0 from 0x70 to 0x7F can be
accessed
> from any bank.  I love this feature!

I like it too.  I use it mostly for "general purpose registers".

> Is there any way to expand it?

No.  It is what it is.  Note that some PICs don't have this at all.  The 18
family has a different approach where you can have 128 common bytes in an
"access bank".

> If I want to expand the mirror memory to another 16 locations, it seems
like
> I have to write lots of code!

That would be rather silly in most circumstances.

> Any there any faster and more efficent way?

Use an 18 family PIC or design the software structure to fit what you have
instead of trying to change the hardware into something it isn't.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, .....olinKILLspamspam.....embedinc.com, http://www.embedinc.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


2001\04\19@020410 by Quentin

flavicon
face
No, register 0x070, which is available on all the banks.

Quentin

Bob Ammerman wrote:
>
> > Careful if you use ICD. These are also used by the debugger.
> > Very funny things happens if you write to it.
> >
> > Quentin
>
> Write to what? The FSR? I do that all the time when debugging on ICD.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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