Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Getting The Program Counter in C

2005-12-01 by Terry Slocum

I'm trying to track down a bug in an existing program. I believe it is 
getting stuck in a loop. Once the error occurs the only way to restore 
communication is to reset the processor. It would help a lot if I could 
locate the place in the code where it is getting stuck. I would like to 
be able to store the Program Counter, Hardware Stack Pointer and Data 
Stack Pointer (Y Register) in EEPROM so I can output them the next time 
the processor boots. The problem is that the code is in C. I am not 
sure how to get a value from a hardware register and store it in a C 
variable. I am using the CodeVisionAVR compiler.  Any ideas?  

Terry

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.