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

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

STM32F302的ADC采集芯片破解

  1. 芯片破解void ADC2_init(void)
  2. {
  3.         GPIO_InitTypeDef          GPIO_InitStructure;
  4.         ADC_InitTypeDef           ADC_InitStructure;
  5.         ADC_CommonInitTypeDef     ADC_CommonInitStructure;
  6.         
  7.         RCC_ADCCLKConfig(RCC_ADC12PLLCLK_Div2);

  8.   /* Enable ADC12 clock */
  9.   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_ADC12, ENABLE);

  10.   /* ADC Channel configuration */
  11.   /* GPIOC Periph clock enable */
  12.   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC|RCC_AHBPeriph_GPIOA, ENABLE);

  13.   /* Configure ADC Channel5 as analog input */
  14.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 ;
  15.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
  16.   GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
  17.   GPIO_Init(GPIOC, &GPIO_InitStructure);
  18.         
  19.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;
  20.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
  21.   GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  22.   GPIO_Init(GPIOA, &GPIO_InitStructure);

  23.   ADC_StructInit(&ADC_InitStructure);

  24.   /* Calibration procedure */  
  25.   ADC_VoltageRegulatorCmd(ADC2, ENABLE);

  26.   ADC_SelectCalibrationMode(ADC2, ADC_CalibrationMode_Single);
  27.   ADC_StartCalibration(ADC2);

  28.   while(ADC_GetCalibrationStatus(ADC2) != RESET );
  29.   calibration_value = ADC_GetCalibrationValue(ADC2);

  30.   ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;                                                                    
  31.   ADC_CommonInitStructure.ADC_Clock = ADC_Clock_AsynClkMode;                    
  32.   ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;            
  33.   ADC_CommonInitStructure.ADC_DMAMode = ADC_DMAMode_OneShot;                  
  34.   ADC_CommonInitStructure.ADC_TwoSamplingDelay = 0;         
  35.   ADC_CommonInit(ADC2, &ADC_CommonInitStructure);

  36.   ADC_InitStructure.ADC_ContinuousConvMode = ADC_ContinuousConvMode_Enable;
  37.   ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
  38.   //ADC_InitStructure.ADC_ExternalTrigConvEvent = ADC_ExternalTrigConvEvent_0;         
  39.   ADC_InitStructure.ADC_ExternalTrigEventEdge = ADC_ExternalTrigEventEdge_None;
  40.   ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
  41.   ADC_InitStructure.ADC_OverrunMode = ADC_OverrunMode_Disable;   
  42.   ADC_InitStructure.ADC_AutoInjMode = ADC_AutoInjec_Enable;  //自动注入使能
  43.   ADC_InitStructure.ADC_NbrOfRegChannel = 1;
  44.   ADC_Init(ADC2, &ADC_InitStructure);

  45.   /* Enable ADC2 */
  46.   ADC_Cmd(ADC2, ENABLE);

  47. }



联系方式

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

在线客服
热线电话

企业微信