about the stack operation error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

about the stack operation error

1,417 Views
m7Cgde
Contributor I

Hi,Dear Friends,

 

When the program returns from the Interrupt service program,the PC pointer must be poped from stack.But I found that the PC pointer is error,the stack content which is PC pointer saved is DE7F,but when poped from the stack,the PC pointer is FE7F.Could you help explain why?

 

Thanks.

 

Ningyinggen

Labels (1)
0 Kudos
4 Replies

374 Views
m7Cgde
Contributor I
Hi,Dear Friends,

Thanks for your reply, it is not the problem of stack size, I have a try to increasing stack size enough,but have the same problem.
0 Kudos

374 Views
peg
Senior Contributor IV

Hi,

 

How about you post your ISR code then.

 

0 Kudos

374 Views
bigmac
Specialist III

Hello Ningyinggen,

 

You might try increasing the size of the stack.  When the stack is too small, more often the stack will over-write static variables.  However, it is also possible that a write to a static variable, within an ISR, can corrupt the stack under these circumstances.

 

If the unspecified device that you are using has a very small amount of RAM, another possibility is to allocate global/static variables to zero page RAM.  This would allow you to increase the stack size.  With a small device, it is also inadvisable to attempt to implement floating point operations.  Nested interrupts should also be avoided.  These require copious quantities of stack.

 

Regards,

Mac

 

0 Kudos

374 Views
tonyp
Senior Contributor II
Could you be corrupting the stack while inside the ISR?
0 Kudos