ARM Technical Support Knowledge Articles

UPDATING THE PROGRAM COUNTER ON THE STACK

Applies to: C51 C Compiler

Answer

Information in this article applies to:


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

Article last edited on: 2006-11-15 13:08:26

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential