how to get stack pointer (SP)

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

how to get stack pointer (SP)

2,128 Views
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
Labels (1)
0 Kudos
Reply
2 Replies

592 Views
CrasyCat
Specialist III
Hello
 
What about
   TFR SP, D
   STD u16sp 
 
CrasyCat
0 Kudos
Reply

592 Views
mikoran
Contributor II
ok tnx.
it works..
0 Kudos
Reply