芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

飞芯科技-芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

protues仿真stm32f103输出PWM 附程序IC解密

  1. IC解密#include "pbdata.h"

  2. u16 fre;
  3. void RCC_Configuration(void);
  4. void GPIO_Configuration(void);
  5. void TIM3_Configuration();

  6. void  Delay (uint32_t nCount)
  7. {
  8.   for(; nCount != 0; nCount--);
  9. }

  10. int main(void)
  11. {
  12.      u16 arr=42000;
  13.      u16 led_dt = arr/2;

  14.                  RCC_Configuration();        //系统时钟初始化
  15.                  GPIO_Configuration();//端口初始化
  16.                  TIM3_Configuration(arr);//定时器和pwm配置
  17.         
  18.                  while(1)
  19.                  {        
  20.                                 TIM_SetCompare2(TIM3,led_dt); //用的是TIM3的通道2,输出PWM         送到相应的寄存器中   //满占空比为900               
  21.                         

  22.                                                 GPIO_SetBits(GPIOB,GPIO_Pin_5);        //LED 发光
  23.                                                         Delay(0x2ffff);
  24.                                                 GPIO_ResetBits(GPIOB,GPIO_Pin_5);//LED 熄灭
  25.                                                         Delay(0x2ffff);
  26.                                                 
  27.                               
  28. //                                        if(GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_7)== Bit_RESET)
  29. //                                                        {
  30. //                                                                //LED 发光
  31. //                                                                GPIO_SetBits(GPIOB,GPIO_Pin_5);
  32. //                                                         }
  33. //                                        else
  34. //                                                        {
  35. //                                                                //LED 熄灭                                 
  36. //                                                                GPIO_ResetBits(GPIOB,GPIO_Pin_5);
  37. //                                                         }
  38.                  }        
  39. }

  40. void RCC_Configuration(void)
  41. {
  42.   SystemInit();

  43.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1,ENABLE);//这个是必须的,仿真软件必须的
  44.         RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3,ENABLE);
  45.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);//端口复用,一定在APB2的时钟线
  46.   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
  47.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
  48.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
  49. }

  50. void GPIO_Configuration(void)
  51. {
  52.   GPIO_InitTypeDef GPIO_InitStructure;
  53.          
  54. //PWM
  55.         GPIO_InitStructure.GPIO_Pin= GPIO_Pin_7;
  56.         GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
  57.         GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;      //通过PWM控制,端口为复用方式输出
  58.         GPIO_Init(GPIOA,&GPIO_InitStructure);
  59.         
  60. //LED
  61.         GPIO_InitStructure.GPIO_Pin= GPIO_Pin_5;
  62.         GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
  63.         GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;      
  64.         GPIO_Init(GPIOB,&GPIO_InitStructure);
  65.         
  66. //BUTTON
  67.         GPIO_InitStructure.GPIO_Pin=GPIO_Pin_7;
  68.         GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPD;
  69.         GPIO_Init(GPIOC,&GPIO_InitStructure);
  70. }



联系方式

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

在线客服
热线电话

企业微信