PIC16F15385 program memory issue,crosses page boundary

(instructions, reset, WDT, specifications...) PIC12F6xx, PIC16Fxxx, PIC16F6x, PIC16F7x

PIC16F15385 program memory issue,crosses page boundary

Postby sailaja chitra » Thu Jul 23, 2020 9:01 am

Hi,
I am working with pic16f15385 controller, while using program memory page segmentation I am getting "Crossing page boundary -- ensure page bits are set."
I cant provide my code here(restricted to my organization only)..after reading datasheet I have set pageselection like below
PAGE0 macro
bcf PCLATH,3
bcf PCLATH,4
endm

PAGE1 macro
bsf PCLATH,3
bcf PCLATH,4
endm

while calling my required subroutines in timer IRQs,i have shifted to PAGE1(those subroutines definitions are under page 1 org 0x800) after required calls again came back to PAGE0..i have checked memory address list,like upto what extent of memory code utilized..it came around 0C36(so within page1 only),it doesnot exceed the PAGE1 memory..

Can you please help me to overcome these warnings?,why I am getting even though it is in the correct boundary??
please clarify ??
sailaja chitra
 
Posts: 3
Joined: Thu Jul 23, 2020 8:43 am

Re: PIC16F15385 program memory issue,crosses page boundary

Postby ric » Thu Jul 23, 2020 10:08 am

I assume you are using MPLASM in ABSOLUTE mode, not RELOCATEABLE mode.
You must not allow any code to straddle the page boundary. Use an ORG directive to place the page 1 code starting from 0x800

Throw away those macros, and use the built in PAGESEL macro.
Assuming you want to call a subroutine named "mysub" in a different page, do this.
Code: Select all
    PAGESEL mysub   ; set the PCLATH bits
    CALL    mysub   ; do the call
    PAGESEL $       ; restore the PCLATH bits


(n.b. your macros appear to be based on how this was done on old PIC16F chips. Enhanced devices have a MOVLP instruction which makes it much simpler.)
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: PIC16F15385 program memory issue,crosses page boundary

Postby sailaja chitra » Thu Jul 23, 2020 2:02 pm

Hi, thanks alot for your reply.
we are using MPASM and using MPLAB X ide. I used ORG directive from 0x800 already and placed page1 code from 0x800..problem here is while calling page1 subroutines from page0 I im getting page boundary issue(even though I am changing page0 to page before calling page 1 code),I will try with PAGESEL macro and will reply to you about that..
But now I cant use MOVLP instruction for this controller right?...
I am unable to trace out here is,because of what mistake I am getting this crossing page boundary issue??I am taking care while calling page1 subroutines and kept ORG 0x800..

Please suggest if anything is wrong in this approach?? Thank you inadvance
sailaja chitra
 
Posts: 3
Joined: Thu Jul 23, 2020 8:43 am

Re: PIC16F15385 program memory issue,crosses page boundary

Postby ric » Thu Jul 23, 2020 9:16 pm

sailaja chitra wrote:we are using MPASM and using MPLAB X ide.

You didn't reveal if you are using ABSOLUTE or RELOCATEABLE mode.

MPLAB 8 defaults to ABSOLUTE mode when you create a new project.
MPLABX defaults to RELOCATABLE mode for new projects. In that mode, you must place the code for each page into its own section.

I used ORG directive from 0x800 already and placed page1 code from 0x800..problem here is while calling page1 subroutines from page0 I im getting page boundary issue(even though I am changing page0 to page before calling page 1 code),
It's really hard to comment in more detail without seeing your actual code.
Can you strip out the secret bits to creaate a version you CAN post that produces the same error when assembled?

But now I cant use MOVLP instruction for this controller right?...

I never said you can't use MOVLP. It's so simple on these new PICs that you can pretty much use it instead of PAGESEL.
Using PAGESEL makes your code more universal, i.e. the same code will assemble on older PICs that don't have the MOVLP instruction.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: PIC16F15385 program memory issue,crosses page boundary

Postby sailaja chitra » Fri Jul 24, 2020 5:53 am

I have checked mode in the properties of MPLAB X IDE of my project..It is Absolute mode..this mode is enabled..
Thankyou for MOVLP instruction clarity,i will use it for better understand in the up coming process..

Yesterday I used PAGESEL instead of macros as you suggested,but no changes in the warnings of "Crossing page boundary -- ensure page bits are set"..All warnings are remained same..i am searching for the root cause of those warnings..where page boundary logic is missing(code didn't crossed Page 1 memory,checked in .lst file )


Please Suggest me any solution for these warnings
sailaja chitra
 
Posts: 3
Joined: Thu Jul 23, 2020 8:43 am

Re: PIC16F15385 program memory issue,crosses page boundary

Postby ric » Fri Jul 24, 2020 6:29 am

I think you are misunderstanding the requirement for setting those bits. You do it when you are about to to a CALL or GOTO to a different page.
You will still get that warning if you have any code that runs off the end of one page into the following page.
I can only guess what you have done if you won't show any code that causes the warning.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: PIC16F15385 program memory issue,crosses page boundary

Postby ric » Sat Aug 01, 2020 2:41 am

So is the problem solved?
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to 14-Bit Core

Who is online

Users browsing this forum: No registered users and 5 guests

cron