Truncated match.
PICList
Thread
'Can someone help me understand memory pages?'
1995\12\27@230306
by
Mike Goelzer
|
I'm writing a program for the PIC16C57 and having some strange
problems.
Basically, I can't seem to write any code past address 200h
(IOW, I can't write more than 512 words of code) without the
program behaving very strangely. When my program is 511
words (last instruction at 1FFh), it works fine. Then when
I add a couple of NOPs anywhere in the program to push the
code over the 200h boundry (past the 512-word boundry), it
starts doing all sorts of odd things. Note that the program
does not crash, it just behaves strangely.
Anyway, I would expect this type of behavior from, say, a
PIC16C54 which has only 512-words of code space. But I'm
using a C57, which is supposed to have 2K.
After banging my head against the proverbial wall for a
while, I finally remembered that the PIC has 512 word pages.
So I was thinking that maybe there is something special you
have to do to move into another page. And the more I think
about it, the strange behavior I'm getting seems to be
similar to the type of behavior I would expect if the last
couple instruction words were getting cut out of my program.
So can someone help me: is there something special I need
to do after my code spills over onto a second page?
Thanks for any help. It will be greatly appreciated.
-mike
spam_OUTmgoelzerTakeThisOuT
us.net
1995\12\28@050631
by
eyal
|
On Thu, 28 Dec 95 02:01:07 GMT Mike Goelzer wrote:
>
> I'm writing a program for the PIC16C57 and having some strange
> problems.
>
> Basically, I can't seem to write any code past address 200h
> (IOW, I can't write more than 512 words of code) without the
> program behaving very strangely.
--------- cut ------------
> So can someone help me: is there something special I need
> to do after my code spills over onto a second page?
>
> Thanks for any help. It will be greatly appreciated.
>
> -mike
> .....mgoelzerKILLspam
@spam@us.net
>
You shold set the page select bits in the status register before ussing
a "call" or "goto" to the code in the second code page The address in the
opcode is only 9 bit and the PIC uses the pages select bits to create
an 11 bit address.
The page select bits are set to '0' after reset. The program counter is 11
bits so the progrm can continue from address 1ffh to 200h and if you
have a "goto" from the code in the second code page it will go to the first
code page.
The stack is 11 bit wide so the "retlw" will return from the second code page
to the original page to the command after the "call" , but it will not change
the page select bits.
If you have a "goto" or "call" command from the first code page to the second
and did not set the code page bits the actual address will set the upper to
bits to '0' and will be in the middel of what ever you have in the first code
page. Just remember to set the code page bits to '0' after you return to the
code in the first page so any "goto" or "call" will no go to the second page.
___________________________________________________________________
|\/\/\/|
| | Eyal Oppenheimer
| |
| (o)(o) Aladdin Knowledge Systems Ltd.
C _) Tel: +972-3-537-5795
| ,___| Fax: +972-3-537-5796
| / E-mail: eyal
KILLspamaladdin.co.il
/____\ WWW: http://www.aks.com/
/ \
___________________________________________________________________
More... (looser matching)
- Last day of these posts
- In 1995
, 1996 only
- Today
- New search...