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

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

单片机解密NV32F100的RTC计时时钟

单片机解密NV32F100的RTC计时时钟引脚输出高低电平的语句定义为:
#define OLED_SCLK_Clr() GPIO_PinClear(GPIO_PTE1);  
#define OLED_SCLK_Set() GPIO_PinSet(GPIO_PTE1);


#define OLED_SDIN_Clr() GPIO_PinClear(GPIO_PTE0);  
#defineOLED_SDIN_Set() GPIO_PinSet(GPIO_PTE0);


单片机解密实现RTC时钟的程序代码如下:

  1. #include "common.h"
  2. #include "ics.h"
  3. #include "rtc.h"
  4. #include "uart.h"
  5. #include "gpio.h"
  6. #include "sysinit.h"
  7. #include "start.h"
  8. #include "oledfont.h"
  9. #include "oled.h"

  10. void cd11()
  11. {  
  12.         OLED_Clear();
  13.         OLED_ShowString(24,0,"RTC CLOCK",16);
  14.         OLED_ShowString(24,4,"jinglixixi",16);
  15. }

  16. void RTC_Task(void);

  17. int main (void)
  18. {
  19.     sysinit();
  20.     cpu_identify();

  21.     RTC_ConfigType  sRTCConfig;
  22.     RTC_ConfigType  *pRTCConfig = &sRTCConfig;

  23.     pRTCConfig->u16ModuloValue = 9;                                    
  24.     pRTCConfig->bInterruptEn   = RTC_INTERRUPT_ENABLE;   
  25.     pRTCConfig->bClockSource   = RTC_CLKSRC_1KHZ;        
  26.     pRTCConfig->bClockPresaler = RTC_CLK_PRESCALER_100;   
  27.    
  28.     RTC_SetCallback(RTC_Task);
  29.     RTC_Init(pRTCConfig);

  30.     GPIO_Init(GPIOB, GPIO_PTE7_MASK, GPIO_PinOutput);
  31.     GPIO_Init(GPIOB, GPIO_PTE7_MASK, GPIO_PinOutput);
  32.     GPIO_Init(GPIOB, GPIO_PTE0_MASK, GPIO_PinOutput);
  33.     GPIO_Init(GPIOB, GPIO_PTE1_MASK, GPIO_PinOutput);
  34.     OLED_Init();
  35.     OLED_Clear();
  36.     cd11();
  37.     OLED_ShowString(24,6,"2018.6.30",16);
  38.    
  39.     while (1)
  40.     {
  41.            OLED_ShowNum(24,2,hh,2,16);
  42.            OLED_ShowChar(40,2,':',16);
  43.            OLED_ShowNum(48,2,mm,2,16);
  44.            OLED_ShowChar(64,2,':',16);
  45.            OLED_ShowNum(72,2,ss,2,16);
  46.            if(ss==60)
  47.            {
  48.                   ss=0;
  49.                   mm=mm+1;
  50.            }
  51.            if(mm==60)
  52.            {
  53.                  mm=0;
  54.                  hh=hh+1;
  55.            }
  56.            if(hh==24)
  57.            {
  58.                 hh=0;
  59.            }
  60.     }
  61. }

  62. void RTC_Task(void)
  63. {
  64.          GPIO_Toggle(GPIOB, GPIO_PTE7_MASK);
  65.          ss++;
  66. }
复制代码

OLED 屏的相关显示函数有:
  1. void OLED_ShowChar(unsigned char x,unsigned char y,unsigned char chr,unsigned char Char_Size)
  2. {              
  3.         unsigned char c=0,i=0;        
  4.         c=chr-' ';               
  5.         if(x>Max_Column-1){x=0;y=y+2;}
  6.         if(Char_Size ==16)
  7.         {
  8.                  OLED_Set_Pos(x,y);        
  9.                  for(i=0;i<8;i++)
  10.                  OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
  11.                  OLED_Set_Pos(x,y+1);
  12.                  for(i=0;i<8;i++)
  13.                  OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
  14.         }
  15.         else
  16.         {        
  17.                  OLED_Set_Pos(x,y);
  18.                  for(i=0;i<6;i++)
  19.                  OLED_WR_Byte(F6x8[c][i],OLED_DATA);
  20.         }
  21. }

  22. uint32_t oled_pow(unsigned char m,unsigned char n)
  23. {
  24.         uint32_t result=1;         
  25.         while(n--)result*=m;   
  26.         return result;
  27. }                                 
  28.                   
  29. void OLED_ShowNum(unsigned char x,unsigned char y,uint32_t num,unsigned char len,unsigned char size2)
  30. {                 
  31.         unsigned char t,temp;
  32.         unsigned char enshow=0;                                                   
  33.         for(t=0;t<len;t++)
  34.         {
  35.                 temp=(num/oled_pow(10,len-t-1))%10;
  36.                 if(enshow==0&&t<(len-1))
  37.                 {
  38.                         if(temp==0)
  39.                         {
  40.                                 OLED_ShowChar(x+(size2/2)*t,y,' ',size2);
  41.                                 continue;
  42.                         }else enshow=1;
  43.                           
  44.                 }
  45.                  OLED_ShowChar(x+(size2/2)*t,y,temp+'0',size2);
  46.         }
  47. }



联系方式

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

在线客服
热线电话

企业微信