This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ST10 / C167 Watchdog

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

Parents
  • 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
    
    In your C program:
    #pragma NOINIT
    int sdata wdtcon_copy;
    #pragma INIT
    After that you can access wdtcon_copy normally. The sdata was used to make sure that DPP3 can be used to access the variable.

    - mike

Reply
  • 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
    
    In your C program:
    #pragma NOINIT
    int sdata wdtcon_copy;
    #pragma INIT
    After that you can access wdtcon_copy normally. The sdata was used to make sure that DPP3 can be used to access the variable.

    - mike

Children
No data