| |||||
Technical Support Support Resources
Product Information | A51: READING THE PROGRAM COUNTERInformation in this article applies to:
QUESTIONHow can I get the address currently in the program counter? ANSWERThe 8051 has no direct way to read the program counter. However, there are several tricks you can use to get the contents of the program counter. Note that the address in the program counter is a 16-bit value. And, the program counter changes while executing code to get its address. Method 1
MOV DPTR,$
At this point, DPTR contains the address of the MOV DPTR instruction. Method 2
LCALL here
here:
POP DPH
POP DPL
At this point, DPTR contains the address of the here label. MORE INFORMATIONFORUM THREADSThe following Discussion Forum threads may provide information related to this topic. Last Reviewed: Monday, January 08, 2007 | ||||
| |||||