| 通过读取RSTFLAG标志来判断也是可以的。
 不过需要注意RSTFLAG是扩展寄存器,访问前需要开启扩展寄存器访问使能。
 
 
 复制代码    if(RSTFLAG & 0x10)  //LVDRSTF
    {
        RSTFLAG |= 0x10;    //写1清除标志位
        printf("LVD reset.temp=%u\r\n",temp);
    }
    if(RSTFLAG & 0x08)  //WDTRSTF
    {
        RSTFLAG |= 0x08;    //写1清除标志位
        printf("Watchdog reset.temp=%u\r\n",temp);
    }
    if(RSTFLAG & 0x04)  //SWRSTF
    {
        RSTFLAG |= 0x04;    //写1清除标志位
        printf("Software reset.temp=%u\r\n",temp);
    }
    if(RSTFLAG & 0x02)  //ROMOVF
    {
        RSTFLAG |= 0x02;    //写1清除标志位
        printf("ROM Overflow reset.temp=%u\r\n",temp);
    }
    if(RSTFLAG & 0x01)  //EXRSTF
    {
        RSTFLAG |= 0x01;    //写1清除标志位
        printf("External reset.temp=%u\r\n",temp);
    }
 
 
 |