在 PIC16/18 中捕获中断之前是否可以知道 PCL 的值?
我想知道在捕获中断之前程序行中执行的最后一条指令是什么。看来读取微控制器堆栈是不可能的。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这在 PIC16 上是不可能的,因为软件无法访问硬件堆栈。不过,可以访问 PIC18 上的硬件堆栈。应用笔记操纵PIC18微控制器的堆栈是一个很好的参考参考。
如果您只想查看调用中断时压入堆栈的 PCL 值,则只需读取
TOSU
、TOSH
和TOSL寄存器。
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
andTOSL
registers.