Is it possible to know PCL‘s value before an interrupt is caught in PIC16/18?
Вопрос
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.
Не связан с StackOverflow