Did you ever get an answer to this? Seems to me you want to use either the WDT, or an external interrupt. Exactly what will be in the stack will depend on what compiler/library routines you are using.. but you should be able to determine this by looking some disassembled ISRs. Once you determine the relative stack location in the ISR, you should have no trouble storing (or displaying) the previous PC - jim On Thu, 01 Dec 2005 19:34:55 -0000 "Terry Slocum" <tslocum@pacbell.net> wrote: > 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 > > > > > > > > Yahoo! Groups Links > > > > > >
Message
Re: [AVR-Chat] Getting The Program Counter in C
2005-12-04 by James Washer
Attachments
- No local attachments were found for this message.