Stack pointer

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

Stack pointer

Jump to solution
659 Views
Eric_t
Contributor III

Hi everybody,

 

I am using HCS12 controllers and Codewarrior v3.1.

Is it possible to read the current position of the SP and put it in a integer variable?

 

Thanks

Nikos

Labels (1)
0 Kudos
1 Solution
452 Views
MJW
NXP Employee
NXP Employee

Hello Nikos,

you can, for example, try this:

/*declaration*/

unsigned short oldsp;


...

     /* save current SP */

     asm {

          STS oldsp

     }

...

Best Regards.

MJW

View solution in original post

0 Kudos
2 Replies
453 Views
MJW
NXP Employee
NXP Employee

Hello Nikos,

you can, for example, try this:

/*declaration*/

unsigned short oldsp;


...

     /* save current SP */

     asm {

          STS oldsp

     }

...

Best Regards.

MJW

0 Kudos
452 Views
Eric_t
Contributor III

Thanks Jens Winkler

It works

Best regards

Nikos

0 Kudos