I would like to store a copy of the watchdog control register (WDTCON) before the EINIT instruction in my START167 assembler file. I then want to access this variable later in a C module, to determine reason for reset. What is the best way of doing this? Does anybody have any example code for this? Thanks in advance
Here is one way to do it. In START167.A66, put the following before the EINIT:
WDTCON DEFR 0FFAEH EXTRN DPP3:wdtcon_copy:WORD MOV wdtcon_copy,WDTCON
#pragma NOINIT int sdata wdtcon_copy; #pragma INIT