how to get stack pointer (SP)

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

how to get stack pointer (SP)

2,720 次查看
mikoran
Contributor II
can you help me get the value of the stack pointer?
i am working on a module where I would monitor the value of the stack pointer and the program counter upon access violation.
 
I have this code in my interrupt handler:
 
    ISR void CPU12MPU_ISR(void) {
        __asm sts u16sp 
        __asm movw 8,SP,u16pc
       
        S12XAccessViolation_ISR();
    }
 
The problem with this code was it will have an endless loop executing __asm sts u16sp.
 
Is there any way I could get the value of SP?
 
Thanks
标签 (1)
0 项奖励
回复
2 回复数

1,184 次查看
CrasyCat
Specialist III
Hello
 
What about
   TFR SP, D
   STD u16sp 
 
CrasyCat
0 项奖励
回复

1,184 次查看
mikoran
Contributor II
ok tnx.
it works..
0 项奖励
回复