about the stack operation error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

about the stack operation error

2,112 次查看
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

标签 (1)
0 项奖励
回复
4 回复数

1,069 次查看
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 项奖励
回复

1,069 次查看
peg
Senior Contributor IV

Hi,

 

How about you post your ISR code then.

 

0 项奖励
回复

1,069 次查看
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 项奖励
回复

1,069 次查看
tonyp
Senior Contributor II
Could you be corrupting the stack while inside the ISR?
0 项奖励
回复