Keil Logo

C51: Updating the Program Counter on the Stack


Information in this article applies to:

  • C51 Version 5.50 and later

SYMPTOMS

My project needs to update the program counter during an ISR to "return" to a different function than it interrupted. How can I know the location of a function to implement this in C?

CAUSE

The 8051 does not have an accessible register for the program counter or instruction pointer.

RESOLUTION

Use a pointer to any function you'll be "calling" in this manner. Using indirection, you can receive the address of the function, regardless of where it ultimately ends up being located by the linker.

MORE INFORMATION


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.