'Page Boundary Crossing Problem'
I wonder if anyone could possibly help me solve a page
boundary crossing problem which I though I had solved, once having overcome
my PCLATH problems. Basically I have a very long text look-up table (37
separate dt "text,text,text" look-up tables each containing 32 characters)
for display on an LCD module. I am now in the process of combining the
look-up table with my other program routines, but about half way down the
look-up table, I cross the 2k byte page boundary of the PIC16C65. I have
tried to swap the various routines around but upon assembly I keep getting
Message C:\MPLAB_2\MPLAB\RPTR3.ASM 1406 : Crossing page boundary --
ensure page bits are set.
This fault results in the text strings beyond the 2k page boundary being
Could anyone please help me to solve the problem as I though the PCLATH
set-up within the look-up tables would prevent this problem occurring.
Many thanks, best wishes and kind regards: Lee Hewitt (Manchester ENGLAND)
Home E-Mail: aol.comLHewitt104
University E-Mail: eee.salford.ac.ukL.Hewitt
|On Sat, 11 Oct 1997 10:10:56 -0400 Lee Hewitt <AOL.COM> LHewitt104
>This fault results in the text strings beyond the 2k page boundary
>Could anyone please help me to solve the problem as I though the
>set-up within the look-up tables would prevent this problem occurring.
If you set the PCLATH to get to things abve 2K, you have to set it back
before your next CALL or GOTO. If not the CALL or GOTO will go to the
high 2K page and the program will bomb.
Not a big problem so far, until you consider interrupts. ISRs must
(a) Not occur during the table lookup, or
(b) Execute no CALL or GOTO statements, or
(c) Save PCLATH and reset it to the low page before CALL or GOTO, then
restore it before return, or
(d) Have the targets of CALL or GOTOs repeated in both (all) 2K pages so
PCLATH doesn't matter.
Or some other compensation I haven;t though of.
Likely the data in the tables *is* being read, but the PIC bombs trying
to display it.
>This fault results in the text strings beyond the 2k page boundary being
Have you got more than 2k of text? If not, why don't you put all of it
in it's own 2k space? (with the ORG directive.)
You need to include (in the same 2k-block) the short segment of code
that reads the characters (for the 'RETLW char'to work). So:
2)move into PCLATH the high byte of the address of your text-stuffing code
3)CALL this code (in the other 2k block)
4)this code can now set PCLATH for the piece of text you want at the time
- and the RETLW's will work fine
5)when you've finished stuffing characters or whatever, move the high-byte
of the original code on the low 2k-block back into PCLATH
The reason you need to disable interrupts is that the GOTO INTERRUPT statement
you (probably) have at address 0x0004 will fail because bits 11,12 of PCLATH
point at the wrong 2k-block. You can get around this by either repeating the
interrupt code in the same place in the 2k-block with the text (a waste of
or actually putting the interrupt code at 0x0004 instead of a GOTO, and then
save and restore PCLATH before doing any CALLs or GOTO's.
Anyway, the point of this message is:
Don't cross a 2k boundary while reading the text, put all the text on its own.
Then you only have to cross that boundary before, and after, writing the text.
Hope this helps,
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- New search...