[[ファームウェア関数一覧>ファームウェア関数一覧#d5c56b4f]] *TIM_OC2Init [#d7540600] #contents **ヘッダ宣言 [#dc171281] **関数プロトタイプ [#ra2244f6] void TIM_OC2Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) **動作 [#x5cb4134] - -出力動作におけるタイマの詳細設定を行います。 **引数 [#vf351e6f] -TIMx&br; #include(Macro/TIMx,notitle) &br; -TIM_OCInitStruct --TIM_OCMode #include(Macro/TIM_OCMode,notitle) &br; --TIM_OutputState #include(Macro/TIM_OutputState,notitle) &br; --TIM_OutputNState #include(Macro/TIM_OutputNState,notitle) &br; --TIM_Pulse&br; キャプチャ・コンベア・レジスタ(TIMx_CCRx)の値を設定します。&br; 設定出来る値の範囲は0x0000 ~ 0xFFFFまでの間です。&br; &br; --TIM_OCPolarity #include(Macro/TIM_OCPolarity,notitle) &br; --TIM_OCNPolarity #include(Macro/TIM_OCNPolarity,notitle) &br; --TIM_OCIdleState #include(Macro/TIM_OCIdleState,notitle) &br; --TIM_OCNIdleState #include(Macro/TIM_OCNIdleState,notitle) &br; **戻り値 [#kc381859] -無し **呼び出し関数 [#aa6d869d] -無し **サンプル [#m61bc69f] /* Configures the TIM1 Channel1 in PWM Mode */ TIM_OCInitTypeDef TIM_OCInitStructure; TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable; TIM_OCInitStructure.TIM_Pulse = 0x7FF; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low; TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low; TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set; TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset; TIM_OC2Init(TIM1, &TIM_OCInitStructure); /* Configures the TIM3 Channel1 in Toggle Mode */ TIM_OCInitTypeDef TIM_OCInitStructure; TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_Pulse = 0x7FF; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low; TIM_OC2Init(TIM3, &TIM_OCInitStructure); **参照 [#f274440a] -[[RCC_APB1PeriphClockCmd]]→[[TIM_TimeBaseInit]]→[[TIM_ITConfig]]→[[TIM_Cmd]] -[[NVIC_Init]]→[[NVIC_IRQChannel]] -STMマイコン徹底入門 P. -STMマイコン徹底入門 P.141