[[ファームウェア関数一覧>ファームウェア関数一覧#d5c56b4f]] *TIM_OC1Init [#vb86f4c1] #contents **ヘッダ宣言 [#h0f5c1cc] **関数プロトタイプ [#f585c0b1] void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct) **動作 [#i54ce620] - -出力動作におけるタイマの詳細設定を行います。 **引数 [#h56e2dbf] -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; **戻り値 [#p746e085] -無し **呼び出し関数 [#zaf6bd2c] -無し **サンプル [#x6c191d6] /* 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_OC1Init(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_OC1Init(TIM3, &TIM_OCInitStructure); **参照 [#t31c29b4] -[[RCC_APB1PeriphClockCmd]]→[[TIM_TimeBaseInit]]→[[TIM_ITConfig]]→[[TIM_Cmd]] -[[NVIC_Init]]→[[NVIC_IRQChannel]] -STMマイコン徹底入門 P.141