Discussion in "PIC Microcontroller Discussion" started by    Afnan    Apr 23, 2013.
Tue Apr 23 2013, 12:50 am
#1
Hello
I wrote a program in MikroC for PIC16F877A. it worked correctly but i had to make some additions to the functionality. I observed that when the used ROM reached 30% the program stopped working in Prodeus with error of "Stack overflow during CALL" Operation ".

I thought it is better to switch controller and found pin compatible controller PIC18F452. I converted that same program to this controller but now when the memory of this controller reaches to approximately 14% i start to get "Attempt to execute Illegal Opcode {loaded from PC= various numbers here}, instruction executes as NOP".

What could be the problem. I cant figure it out. Is it Proteus or is it MikroC that is why i planed to switch to MPLAB to check it out but that is real boring IDE. What can it be?
Tue Apr 23 2013, 02:27 am
#2


I observed that when the used ROM reached 30% the program stopped working in Prodeus with error of "Stack overflow during CALL" Operation ".

Afnan


"Stack overflow during CALL" Operation ". has nothing to do with rom size.

PIC devices use a hardware stack.
In the 16f877 it is only 8 levels so you are limited as to how many nested subroutines
calls you can make.
The 18F452 allows up to 31 nested calls, but it may be the same problem.

The limit includes subroutine calls and interrupt handlers.

Tue Apr 23 2013, 02:23 pm
#3
Well i was not considering limitation on subroutine (functions) calls. In my file i tried to make modular look and made many sub functions to isolate the different logic. Can this be the problem?
Tue Apr 23 2013, 06:17 pm
#4
Any of the below reasons:
1. you might be using bigger local variables e.g. buffers in your functions.
2. too many function calls
3. Stack pointer not initialized properly (less probable)

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

RandyBence
Wed May 15 2024, 02:00 pm
JordanDic
Wed May 15 2024, 01:55 pm
DavidDeelf
Wed May 15 2024, 11:16 am
ytaletjkca
Wed May 15 2024, 09:45 am
MildredWoumb
Wed May 15 2024, 04:07 am
NaKrutkADamb
Wed May 15 2024, 12:03 am
MichaelGot
Tue May 14 2024, 04:08 pm
FrankTrelm
Tue May 14 2024, 10:39 am