質問

I want to know what was the last instruction being executed in the program line just before an interrupt has been caught. It seems that reading the microcontroller stack is not possible.

役に立ちましたか?

解決

It is not possible on a PIC16, because the hardware stack is not accessible to software. It is, however, possible to access the hardware stack on the PIC18. The application note Manipulating the Stack of the PIC18 Microcontroller is a good reference.

If you only want to see the PCL value pushed onto the stack when the interrupt was called, then you only have to read the TOSU, TOSH and TOSL registers.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top