芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密

飞芯科技提供芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密逆向服务

松翰SN8F5703单片机WDT例程芯片解密

  1. 松翰SN8F5703单片机WDT例程芯片解密//--------------------------------------------------------------------------
  2. //Filename        : STOP_Mode.c
  3. //Function        : Use watch dog timer to Power save application when SN8F5708 run as stop mode.
  4. //description        : SN8F5708 be waked up by watch dog reset.
  5. //--------------------------------------------------------------------------
  6. //Note:
  7. //     1)User need to add the STARTUP.A51 file which in this project to your project.
  8. //     2)The STARTUP.A51 file has been modified for the Watchdog wakeup function.
  9. //     3)User need to Reset the source which has used according to the PFLAG register.
  10. //--------------------------------------------------------------------------

  11. #include <SN8F5703.h>

  12. #define uchar unsigned char
  13. #define uint unsigned int
  14.        
  15. uchar RCycle_CNT;
  16. //--------------------------------------------------------------------------
  17. //subroutine        : main()
  18. //Function                :
  19. //--------------------------------------------------------------------------
  20. void main(void)
  21. {
  22.                 CLKSEL = 0x03;                                //Fcpu=Fosc/16
  23. //        CLKSEL = 0x04;                                //Fcpu=Fosc/8
  24. //        CLKSEL = 0x05;                                //Fcpu=Fosc/4
  25.                 CLKCMD = 0x69;
  26.                 CKCON = 0x11;
  27.        
  28.                 WDTR = 0X5A;       
  29.                
  30.         if((PFLAG&0X40)==0X40)        //Watchdog Reset
  31.         {       
  32.                 P0UR = 0X00;
  33.                 P0 = 0X00;
  34.                 P0M = 0XFF;
  35.                
  36.                 P1UR = 0X00;
  37.                 P1 = 0X00;
  38.                 P1M = 0XFF;
  39.                
  40.                 P2UR = 0X00;
  41.                 P2 = 0X00;
  42.                 P2M = 0XFF;
  43.         }
  44.         else                                                                                //Other Reset
  45.         {       
  46.                 P0UR = 0X00;
  47.                 P0 = 0XFF;
  48.                 P0M = 0XFF;
  49.                
  50.                 P1UR = 0X00;
  51.                 P1 = 0X00;
  52.                 P1M = 0XFF;
  53.                
  54.                 P2UR = 0X00;
  55.                 P2 = 0X00;
  56.                 P2M = 0XFF;
  57.         }

  58.         while(1)
  59.         {
  60.                 WDTR = 0X5A;
  61.                 RCycle_CNT++;
  62.                 P2 = RCycle_CNT;                //P2 output registor data
  63.                 P1W = 0X00;                                        //Set P1 port wake up source, if enable, user need to set port as input mode
  64.                 STOP();
  65.         }
  66. }



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.taihedz.cn
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信