Searching \ for '[PIC]: Bank bit, FSR and INDF registers' 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=bank
Search entire site for: 'Bank bit, FSR and INDF registers'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Bank bit, FSR and INDF registers'
2001\04\26@155231 by PDRUNEN

picon face
Hi Group,

I know this has been discussed, but, I still have a bit of a problem
understanding the IRP, RP0 and RP1 in relations to the FSR.

In the following code

movlw 0XA0
movwf   fsr
movf indf,w
movwf   temp1

temp1 is a ram location at $45
FSR points to ram location A0 in Bank 1, IRP, RP0, and RP1 are clear.

Before doing the movf indf,w do I have to do anything to the bank bits?
In MPLAB sim mode, I say no, it appears to work without any regards to bank
bit
settings.

Thanks,

Paul

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2001\04\26@164901 by Wayne Hortensius

flavicon
face
At 03:51 PM 4/26/01 -0400, Paul wrote:
>movlw 0XA0
>movwf   fsr
>movf indf,w
>movwf   temp1
>
>temp1 is a ram location at $45
>FSR points to ram location A0 in Bank 1, IRP, RP0, and RP1 are clear.
>
>Before doing the movf indf,w do I have to do anything to the bank bits?
>In MPLAB sim mode, I say no, it appears to work without any regards to bank
>bit settings.

You're right. Direct addressing (e.g. movwf 0xA0) uses the lower 7 bits of
the operand combined with RP0 & RP1 to make a 9 bit address. Indirect
addressing (movwf INDF,W) uses the 8 bits in the FSR combined with IRP to
make a 9 bit address (it doesn't use the RPx bits at all). IRP reset gives
you access to addresses 0x000 to 0x0FF; IRP set gives you 0x100 to 0x1FF.

Regards,
Wayne

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


2001\04\26@210543 by Olin Lathrop

face picon face
> movlw 0XA0
> movwf   fsr
> movf indf,w
> movwf   temp1
>
> temp1 is a ram location at $45
> FSR points to ram location A0 in Bank 1, IRP, RP0, and RP1 are clear.
>
> Before doing the movf indf,w do I have to do anything to the bank bits?

Note that indirect address banks are twice the size of the direct register
banks.  Therefore IRP = 0 selects the 256 bytes in banks 0 and 1, and IRP =
1 selects the 256 bytes in banks 2 and 3.  Since your target is in bank 1
(address 80h - FFh), you need IRP = 0 to access the target indirectly.
Since TEMP1 is in bank 0 (address 00h - 7Fh), you need RP0 = 0 and RP1 = 0
to access it directly.  Therefore, yes, you have all three banks bits set
correctly.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


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