message: function size exceeds page boundaries [main]

General discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
joseLB
Posts: 444
Joined: 02 Apr 2006 05:56
Location: Riode Janeiro, Brasil

message: function size exceeds page boundaries [main]

#1 Post by joseLB » 12 Apr 2024 21:11

Hello!

In MP v 7.6.0, I received that message, on pic 16F1788. Last ok compilation was about 5.7K words, about 1300 lines, main program about 500 lines.

I just added some more code in main program and received this message. What it means? There is a "page size" for a procedure or main program? If yes, what is this size?

Thanks
Jose (A long time I do not come to the forum.... sorry for that!

edit: seems to me that the max. size a routine or main can have is 2048 bytes = 1024 words. If so, why?

Jose

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: message: function size exceeds page boundaries [main]

#2 Post by IvanJeremic » 15 Apr 2024 08:48

Hi,

The program memory in PIC microcontrollers is segmented into pages due to limitations in the program counter's capacity to address the entire memory space.
In instances where a program exceeds the size of one page, it may traverse into adjacent pages, leading to program counter overflow.
To resolve this issue, you will need to adjust the PCLATH register.
I advise that you study the datasheet, particularly those concerning Program Memory Organization, PCL and PCLATH, and Program Memory Paging, all located under the Memory Organization main topic.
https://ww1.microchip.com/downloads/aem ... 01675C.pdf

Regards,

Ivan.

joseLB
Posts: 444
Joined: 02 Apr 2006 05:56
Location: Riode Janeiro, Brasil

Re: message: function size exceeds page boundaries [main]

#3 Post by joseLB » 16 Apr 2024 00:55

Thanks Ivan.

I solved that taking parts of the main program and converting into procedures. At the end, this is a better programing practice, anyway.... :)

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: message: function size exceeds page boundaries [main]

#4 Post by IvanJeremic » 16 Apr 2024 09:19

Glad you managed to solve the issue.

If you have further questions you can always contact us.

Regards,

Ivan.

Post Reply

Return to “mikroPascal PRO for PIC General”