SHARE
TWEET

Untitled

a guest Nov 21st, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void ADCTimInit() {
  2.     RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
  3.  
  4.     TIM_TimeBaseInitTypeDef tim;
  5.     TIM_TimeBaseStructInit( &tim );
  6.     tim.TIM_Period = 2;
  7.     tim.TIM_Prescaler = 1;
  8.     TIM_TimeBaseInit( ADC_TIM, &tim );
  9.  
  10.     TIM_OCInitTypeDef oc;
  11.     TIM_OCStructInit( &oc );
  12.     oc.TIM_OCMode = TIM_OCMode_PWM1;
  13.     oc.TIM_OutputState = TIM_OutputState_Enable;
  14.     //oc.TIM_OCPolarity = TIM_OCPolarity_Low;
  15.     oc.TIM_Pulse = 1;
  16.     TIM_OC1Init(ADC_TIM, &oc);
  17.  
  18.     TIM_CtrlPWMOutputs(ADC_TIM, ENABLE);
  19.  
  20.     TIM_Cmd(ADC_TIM, ENABLE);
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top