Truncated match.
PICList
Thread
'Bank 1 and FSR.'
1999\02\22@053236
by
Vincent Deno
I'm currently using a 16C74 (running Clearview 16CXX emulator). I
ve been trying to use the FSR to access data in Bank 1.
Does anyone know the proper way to do this?
My boss said that RP0 will select the correct bank (for indirect
addressing). But that conflicts with the data sheet and doesn't work
anyway.
I tried defining the variable space (and the corresponding address) in
Bank 0, and adding the page length to the FSR before addressing. Ex:
org 20h
variable ds 1
.
.
.
org somewhere_in_program
mov FSR,variable
add FSR,#80h ; Adds the page length to the FSR.
INDF operation to perform on data.
However, neither of these techniques work. The second approach works
until the address 0xC0, after which it doesn't affect any register.
Any suggestions would be appreciated.
Thanks,
Vincent Deno
1999\02\22@075614
by
Keith Causey
Your boss is right; there is a duplicate fsr in the high and low banks. When
RP0 is '0' the fsr addresses registers in the lower bank. When RP0 is a '1'
the fsr selects registers in the upper bank. The data sheet suggests:
clrf STATUS ;initializes machine to a know state
bsf RP0 'selects bank 1
"whatever you want to do there"
bcf RP0 ;selects bank 0
"now you're back"
>I'm currently using a 16C74 (running Clearview 16CXX emulator). I
>ve been trying to use the FSR to access data in Bank 1.
>
>Does anyone know the proper way to do this?
>
1999\02\22@083325
by
Vincent Deno
|
Again I tried this method with no results (other than writing to bank 0).
Is there an error is this code:
mov W,bank_0_variable
setb RP0
mov INDF,W
According to "the boss", this should write to a location pointed to by the
FSR IN BANK 1. However, it keeps writing to the location pointed to by
the FSR in BANK 0!
If this were the proper way to do it, why then would they write explicitly
in the data sheet that RP0 is for direct addressing, and IRP is the bank
select bit for indirect addressing? If you still have to set RP0 for
indirectly addressing bank 1, what good is IRP?
Thanks Again,
Vincent Deno
{Quote hidden}> Your boss is right; there is a duplicate fsr in the high and low banks. When
> RP0 is '0' the fsr addresses registers in the lower bank. When RP0 is a '1'
> the fsr selects registers in the upper bank. The data sheet suggests:
>
> clrf STATUS ;initializes machine to a know state
> bsf RP0 'selects bank 1
> "whatever you want to do there"
> bcf RP0 ;selects bank 0
> "now you're back"
>
>
> >I'm currently using a 16C74 (running Clearview 16CXX emulator). I
> >ve been trying to use the FSR to access data in Bank 1.
> >
> >Does anyone know the proper way to do this?
> >
>
--------------
Vincent Deno
Design Engineer
Theta Digital Corp.
http://www.thetadigital.com
spam_OUTdenovjTakeThisOuT
email.uc.edu
_____________
| ____ ____ |
|/| | | | | |\|
| | |/| |\| | |
| | | | | | | |
| |_/ | | \_| |
| | | | | |
|_/ /___\ \_|
1999\02\22@111050
by
Byron A Jeff
>
> Again I tried this method with no results (other than writing to bank 0).
> Is there an error is this code:
>
> mov W,bank_0_variable
> setb RP0
> mov INDF,W
>
> According to "the boss", this should write to a location pointed to by the
> FSR IN BANK 1. However, it keeps writing to the location pointed to by
> the FSR in BANK 0!
Nope. This will write the value in W to the address in FSR. The RP0 is
irrelavent. If bit 7 of FSR is 0, it will write to bank 0.
>
> If this were the proper way to do it, why then would they write explicitly
> in the data sheet that RP0 is for direct addressing, and IRP is the bank
> select bit for indirect addressing? If you still have to set RP0 for
> indirectly addressing bank 1, what good is IRP?
Exactly as it should. The RP0 bit isn't used for indirect addressing. This
is because it isn't needed. See in the 14 bit Microchip PIC's there's only
room for 7 bits of direct addressing, hence the need for the RP0/1 bit to
select from up to 4 128 byte banks. However since the FSR is 8 bits it
can directly access the first 2 banks without need of additional bits.
The IRP adds a ninth bit to the indirect addressing. In other words it's
IRP1 not IRP0. The ninth bit lets you select from bank pairs 0/1 and 2/3.
In short: RP0/1 has nothing to do with indirect addressing period.
BAJ
{Quote hidden}>
> Thanks Again,
>
> Vincent Deno
>
>
> > Your boss is right; there is a duplicate fsr in the high and low banks. When
> > RP0 is '0' the fsr addresses registers in the lower bank. When RP0 is a '1'
> > the fsr selects registers in the upper bank. The data sheet suggests:
> >
> > clrf STATUS ;initializes machine to a know state
> > bsf RP0 'selects bank 1
> > "whatever you want to do there"
> > bcf RP0 ;selects bank 0
> > "now you're back"
> >
> >
> > >I'm currently using a 16C74 (running Clearview 16CXX emulator). I
> > >ve been trying to use the FSR to access data in Bank 1.
> > >
> > >Does anyone know the proper way to do this?
> > >
> >
>
> --------------
> Vincent Deno
> Design Engineer
> Theta Digital Corp.
>
http://www.thetadigital.com
>
.....denovjKILLspam
@spam@email.uc.edu
> _____________
> | ____ ____ |
> |/| | | | | |\|
> | | |/| |\| | |
> | | | | | | | |
> | |_/ | | \_| |
> | | | | | |
> |_/ /___\ \_|
>
1999\02\22@114817
by
Nigel Orr
At 05:58 22/02/99 -0700, you wrote:
>Your boss is right; there is a duplicate fsr in the high and low banks. When
>RP0 is '0' the fsr addresses registers in the lower bank. When RP0 is a '1'
>the fsr selects registers in the upper bank. The data sheet suggests:
Nope.
There is one FSR, and one INDF, mirrored in both banks. RP0 is irrelevant
when indirect addressing.
The following code will write to TRISA, whatever the value of RP0
movlw TRISA ;puts 0x85 in w
movwf FSR ;tells FSR to point at 0x85
movlw b'11110000' ;
movwf INDF ;puts the value in w into TRISA, currently accessed at I
NDF
Does that help? I missed the start of the thread.
Nigel
1999\02\22@122307
by
Harold Hallikainen
|
On Mon, 22 Feb 1999 05:30:40 -0500 Vincent Deno <denovj
KILLspamEMAIL.UC.EDU>
writes:
{Quote hidden}>I'm currently using a 16C74 (running Clearview 16CXX emulator). I
>ve been trying to use the FSR to access data in Bank 1.
>
>Does anyone know the proper way to do this?
>
>My boss said that RP0 will select the correct bank (for indirect
>addressing). But that conflicts with the data sheet and doesn't work
>anyway.
>
>I tried defining the variable space (and the corresponding address) in
>Bank 0, and adding the page length to the FSR before addressing. Ex:
> org 20h
>variable ds 1
>
>.
>.
>.
> org somewhere_in_program
>
> mov FSR,variable
> add FSR,#80h ; Adds the page length to the FSR.
> INDF operation to perform on data.
>
>However, neither of these techniques work. The second approach works
>until the address 0xC0, after which it doesn't affect any register.
>
>Any suggestions would be appreciated.
>
>Thanks,
>
>Vincent Deno
>
Your assembler looks different than the Microchip one I'm used
to. Also, does the ds code you have place the variable in bank 1? Looks
like it's in bank 0 to me.
The problem with banks of ram is due to there only being 7 bits
to address ram in the instruction word. Since the fsr is 8 bits, it can
address all 256 bytes of ram without use of the RP bits.
Here's some code I'd use (in Microchip format)...
cblock 0x80 ; Start variables in bank 1
variable 1
variable 2
variable 3
endc
cblock ; You can put in cblocks without an address
and it will use
; the next ram space. Nice way of encapsulating
variables
; with subroutines...
variable 4
variable 5
endc
movlw variable1 ; Get address of variable 1 in w
movwf fsr ; Put it in fsr (index register)
movfw indf ; Get data from variable 1 into w
incf fsr,1 ; Bump pointer to variable 2
movfw indf ; Get variable 2, if you want it
Harold
Harold Hallikainen
.....haroldKILLspam
.....hallikainen.com
Hallikainen & Friends, Inc.
See the FCC Rules at http://hallikainen.com/FccRules and comments filed
in LPFM proceeding at http://hallikainen.com/lpfm
___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]
1999\02\22@130312
by
Dwayne Reid
|
>Again I tried this method with no results (other than writing to bank 0).
>Is there an error is this code:
>
> mov W,bank_0_variable
> setb RP0
> mov INDF,W
>
Here, try this.
movlw address ;address you want to write to
movwf fsr
movlw data ;data you want to write there
movwf inadr
See? FSR contains the address you want to read from or write to.
Anything you do to INADR is acting on the data at that address.
Think of FSR as a pointer to the data, think of INADR as the data at that
address.
FSR and INADR are 'mirrored' in both bank 0 and bank 1. That means that it
doesn't matter if RP0 is set or clear.
I hope this helps.
dwayne
Dwayne Reid <EraseMEdwaynerspam_OUT
TakeThisOuTplanet.eon.net>
Trinity Electronics Systems Ltd Edmonton, AB, CANADA
(403) 489-3199 voice (403) 487-6397 fax
Celebrating 15 years of Engineering Innovation (1984 - 1999)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Do NOT send unsolicited commercial email to this email address.
My posting messages to Usenet neither grants consent to receive
unsolicited commercial email nor is intended to solicit commercial
email.
1999\02\22@140452
by
Gerhard Fiedler
|
At 08:31 02/22/99 -0500, Vincent Deno wrote:
>Again I tried this method with no results (other than writing to bank 0).
>Is there an error is this code:
>
> mov W,bank_0_variable
> setb RP0
> mov INDF,W
>
>According to "the boss", this should write to a location pointed to by the
>FSR IN BANK 1. However, it keeps writing to the location pointed to by
>the FSR in BANK 0!
>
>If this were the proper way to do it, why then would they write explicitly
>in the data sheet that RP0 is for direct addressing, and IRP is the bank
>select bit for indirect addressing? If you still have to set RP0 for
>indirectly addressing bank 1, what good is IRP?
other than with "normal" variable access, you use a full 8 bit address for
the indirect access: 0x00..0x7f is bank0 or bank2, 0x80..0xff is bank1 or
bank3. the IRP bit selects between bank0/1 and bank2/3. RP0/1 are
completely irrelevant, since INDF exists in all 4 banks.
so in order for the code to work as you want, bank_0_variable must be in
the range 0x80..0xff and should in reality be a "bank_1_variable"... :)
(or you set bit 7 of W before you write it to INDF.)
ge
1999\02\22@190243
by
Byron A Jeff
{Quote hidden}>
> >Again I tried this method with no results (other than writing to bank 0).
> >Is there an error is this code:
> >
> > mov W,bank_0_variable
> > setb RP0
> > mov INDF,W
> >
>
>
> Here, try this.
>
> movlw address ;address you want to write to
> movwf fsr
>
> movlw data ;data you want to write there
> movwf inadr
>
> See? FSR contains the address you want to read from or write to.
> Anything you do to INADR is acting on the data at that address.
>
> Think of FSR as a pointer to the data, think of INADR as the data at that
> address.
>
> FSR and INADR are 'mirrored' in both bank 0 and bank 1. That means that it
> doesn't matter if RP0 is set or clear.
>
> I hope this helps.
Well Dwayne, that really wasn't the question he was asking. His boss told him
that if he dropped a bank_0 address in FSR and set RP0, that the access to
INDF would access the corresponding bank_1 address (i.e. FSR=0XXXXXXX + RP0=1
produces INDF of 1XXXXXXX)
That's not true. RP0 doesn't enter into the FSR/INDF situation because FSR is
8 bits and therefor can address both banks 0 and 1 directly (or indrectly as
it were ;-)
IRP does enter the equation because when its set, the address in FSR points
to banks 2 and 3 instead of 0 and 1 (i.e. FSR=XXXXXXXX + IRP=1 produces INDF
of 1XXXXXXXX. Note that it's a 9 bit address).
In short, the boss was incorrect.
BAJ
1999\02\22@232609
by
Vincent Deno
|
I have chalked this problem up to an emulator hardware error (part of the
cost of using outdated equipment). Your latest posting is in complete
agreement with what I thought in the first place. For once, the boss IS
wrong. ;]
Thanks for your input.
-Vincent Deno
On Mon, 22 Feb 1999, Byron A Jeff wrote:
{Quote hidden}> >
> > Again I tried this method with no results (other than writing to bank 0).
> > Is there an error is this code:
> >
> > mov W,bank_0_variable
> > setb RP0
> > mov INDF,W
> >
> > According to "the boss", this should write to a location pointed to by the
> > FSR IN BANK 1. However, it keeps writing to the location pointed to by
> > the FSR in BANK 0!
>
> Nope. This will write the value in W to the address in FSR. The RP0 is
> irrelavent. If bit 7 of FSR is 0, it will write to bank 0.
>
> >
> > If this were the proper way to do it, why then would they write explicitly
> > in the data sheet that RP0 is for direct addressing, and IRP is the bank
> > select bit for indirect addressing? If you still have to set RP0 for
> > indirectly addressing bank 1, what good is IRP?
>
> Exactly as it should. The RP0 bit isn't used for indirect addressing. This
> is because it isn't needed. See in the 14 bit Microchip PIC's there's only
> room for 7 bits of direct addressing, hence the need for the RP0/1 bit to
> select from up to 4 128 byte banks. However since the FSR is 8 bits it
> can directly access the first 2 banks without need of additional bits.
>
> The IRP adds a ninth bit to the indirect addressing. In other words it's
> IRP1 not IRP0. The ninth bit lets you select from bank pairs 0/1 and 2/3.
>
> In short: RP0/1 has nothing to do with indirect addressing period.
>
> BAJ
> >
> > Thanks Again,
> >
> > Vincent Deno
> >
> >
> > > Your boss is right; there is a duplicate fsr in the high and low banks. Wh
en
{Quote hidden}> > > RP0 is '0' the fsr addresses registers in the lower bank. When RP0 is a '1
'
> > > the fsr selects registers in the upper bank. The data sheet suggests:
> > >
> > > clrf STATUS ;initializes machine to a know state
> > > bsf RP0 'selects bank 1
> > > "whatever you want to do there"
> > > bcf RP0 ;selects bank 0
> > > "now you're back"
> > >
> > >
> > > >I'm currently using a 16C74 (running Clearview 16CXX emulator). I
> > > >ve been trying to use the FSR to access data in Bank 1.
> > > >
> > > >Does anyone know the proper way to do this?
> > > >
> > >
> >
> > --------------
> > Vincent Deno
> > Design Engineer
> > Theta Digital Corp.
> >
http://www.thetadigital.com
> >
denovj
spam_OUTemail.uc.edu
> > _____________
> > | ____ ____ |
> > |/| | | | | |\|
> > | | |/| |\| | |
> > | | | | | | | |
> > | |_/ | | \_| |
> > | | | | | |
> > |_/ /___\ \_|
> >
>
--------------
Vincent Deno
Design Engineer
Theta Digital Corp.
http://www.thetadigital.com
@spam@denovjKILLspam
email.uc.edu
_____________
| ____ ____ |
|/| | | | | |\|
| | |/| |\| | |
| | | | | | | |
| |_/ | | \_| |
| | | | | |
|_/ /___\ \_|
1999\02\23@034319
by
Dr. Imre Bartfai
|
Hi,
the second approach is good. However, you should write:
mov FSR,#variable
as you should set the ADDRESS of the variable rather than its content.
Your boss is wrong. RP0 stands for direct addressing only.
I hope this helps.
Imre
On Mon, 22 Feb 1999, Vincent Deno wrote:
{Quote hidden}> I'm currently using a 16C74 (running Clearview 16CXX emulator). I
> ve been trying to use the FSR to access data in Bank 1.
>
> Does anyone know the proper way to do this?
>
> My boss said that RP0 will select the correct bank (for indirect
> addressing). But that conflicts with the data sheet and doesn't work
> anyway.
>
> I tried defining the variable space (and the corresponding address) in
> Bank 0, and adding the page length to the FSR before addressing. Ex:
> org 20h
> variable ds 1
>
> ..
> ..
> ..
> org somewhere_in_program
>
> mov FSR,variable
> add FSR,#80h ; Adds the page length to the FSR.
> INDF operation to perform on data.
>
> However, neither of these techniques work. The second approach works
> until the address 0xC0, after which it doesn't affect any register.
>
> Any suggestions would be appreciated.
>
> Thanks,
>
> Vincent Deno
>
>
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- Today
- New search...