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
Message
Getting The Program Counter in C
2005-12-01 by Terry Slocum