문제

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