T3STY
Full Member level 4
- Joined
- Apr 17, 2012
- Messages
- 239
- Helped
- 24
- Reputation
- 48
- Reaction score
- 24
- Trophy points
- 1,308
- Activity points
- 3,715
Due to the very low memory on 16F84, I have switched to the PIC 16F876 (A). I managed to write 70% of the program, but right when I was writing the most important function I've run into a very nonsense stack overflow error in ISIS.
The error happens in the function Esposizione() with the code after line 309. On line 310 I have a function call which is:
LCD_WriteString("Esposizione\ncompletata");
What happens here is, if I write...
LCD_WriteString("Esposizione\ncompl");
...ISIS will go ahead just fine.
If I use any longer text or if I make any other function call after this function, ISIS will complain different either by running the program its way (only an arrow displayed and nothing works) or it will throw this error:
I'm attaching here the whole MPLAB/HiTech PICC project and the ISIS simulation project. I'm sorry I didn't have time to comment the main.c file in english, but the code is a lot self-explainable. If you don't understand anything just ask me.
Oh, almost forgot... the code compiles just fine in MPLAB. There are a few warnings about char variables converted to char pointers, but they're not critical and won't stop the compilation process.
Thanks in advance to anyone willing to help me.
p.s. fast user guide for the program simulation in ISIS (if working)
On startup the display shows a menu. Use the DEC and INC buttons to move the arrow Down/Up. Use SEL to select the menu item.
The function causing issues, Esposizione(), is called on the first item in the menu, "AVVIA ESPOSIZ.". When the program runs the wrong way you should only see an arrow on the first char of the display, but you'll be unable to do anything.
p.p.s. In case you need to translate, Google translate seems to work fine for most of the sentences.
The error happens in the function Esposizione() with the code after line 309. On line 310 I have a function call which is:
LCD_WriteString("Esposizione\ncompletata");
What happens here is, if I write...
LCD_WriteString("Esposizione\ncompl");
...ISIS will go ahead just fine.
If I use any longer text or if I make any other function call after this function, ISIS will complain different either by running the program its way (only an arrow displayed and nothing works) or it will throw this error:
The very strange thing is that the stack overflow does not occur with functions calling other functions inside (like LCD_WriteString() which calls LCD_Write() inside), but with functions going one next the other in the code, which should trigger a PUSH on function call and a POP on function return. This way, the PC should never full fill the stack levels and I should be able to make even 1000 function calls one next the other. I have counted the function calls and I should have not more than 4 stack levels at this point (main() -> Esposizione() -> LCD_WriteString() -> LCD_write() ), and the PIC offers 8 stack levels. Obviously though, something doesn't fit the circumstances, and I'm unable to determine what. Or I may be wrong about function calls and stack levels...[PIC16 CORE] PC=0X0370. Stack overflow executing CALL instruction.
I'm attaching here the whole MPLAB/HiTech PICC project and the ISIS simulation project. I'm sorry I didn't have time to comment the main.c file in english, but the code is a lot self-explainable. If you don't understand anything just ask me.
Oh, almost forgot... the code compiles just fine in MPLAB. There are a few warnings about char variables converted to char pointers, but they're not critical and won't stop the compilation process.
Thanks in advance to anyone willing to help me.
p.s. fast user guide for the program simulation in ISIS (if working)
On startup the display shows a menu. Use the DEC and INC buttons to move the arrow Down/Up. Use SEL to select the menu item.
The function causing issues, Esposizione(), is called on the first item in the menu, "AVVIA ESPOSIZ.". When the program runs the wrong way you should only see an arrow on the first char of the display, but you'll be unable to do anything.
p.p.s. In case you need to translate, Google translate seems to work fine for most of the sentences.
Attachments
Last edited: