Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

stack overflow in proteus

Status
Not open for further replies.

sukhoimg

Junior Member level 1
Joined
Aug 24, 2012
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,399
hello
i'am trying to scroll a message on 15x7 led matrix see below for the code and schematic
the problem is when i run the simulation a message appears "stack overflow executing call instruction " but i'am using just 2 nested loops

this the code written in mikroc:

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
void main()
 
 
{
   const char font[]={0x3E, 0x51, 0x49, 0x45, 0x3E,
                      0x00, 0x42, 0x7F, 0x40, 0x00,
                      0x42, 0x61, 0x51, 0x49, 0x46};
   char i,a,b,c;
   trisa=0;
   trisb=0;
   porta=0;
   portb=0;
 
while(1)
{ for(a=14;a>=0;a--)
    {
     for(b=0;b<15;b++)
     {
        for(i=a;i<15;i++,c++)
        {
          portb=0;
          portb=font[c];
          porta=i;
          delay_ms(1);
 
        }
  }
}
}
}



Sans titre.png
 
Last edited by a moderator:

Nested loops doesn't have anything to do with stack overflow. It happens if there are highly nested functions. Zip and post your project files and Proteus files so that it can be tested.

I don't know whether const data type can be used inside functions. If variable is defined as const type then the data will be in ROM and not in RAM. Your const type array is created during runtime as it is in main function. But in runtime it can't create array in ROM. Maybe this is causing the problem. Remove const type or make the array a global variable.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top