FAQ

よくある質問

What should be considered when using PWM output function in the NuMicro® family?  日付:2015-11-02

When using the PWM output function in the NuMicro® family, the users not only sets the corresponding pin to the PWM output function, but makes sure the PWM clock source is turned on, initializes and enables the PWM output function. Otherwise, the unstable state of the output pin may lead to leakage phenomenon.

 

In the M451 series, for example, the user can follow the steps below to set the PWM output function:

  1. Enable PWM clock:
    CLK_EnableModuleClock(PWM0_MODULE);
  2. Select PWM clock source:
    CLK_SetModuleClock(PWM0_MODULE, CLK_CLKSEL2_PWM0SEL_PCLK0, NULL);
  3. Reset PWM function:
    SYS_ResetModule(PWM0_RST);
  4. Set the pin or PWM function:
    SYS->GPC_MFPL = (SYS->GPC_MFPL & (~SYS_GPC_MFPL_PC0MFP_Msk));
    SYS->GPC_MFPL |= SYS_GPC_MFPL_PC0MFP_PWM0_CH0;
  5. Set the PWM output function:
    PWM_ConfigOutputChannel(PWM0, 0, 180000, 50);
  6. Enable PWM output:
    PWM_EnableOutput(PWM0, PWM_CH_0_MASK);
  7. Start the PWM output:
    PWM_Start(PWM0, PWM_CH_0_MASK);
製品: マイクロコントローラ ,Arm Cortex-M0 MCU ,M051 ベースシリーズ ,M0518シリーズ ,M0519シリーズ ,ミニ 51 ベースシリーズ ,ナノ 100/102 ベースシリーズ ,ナノ 110/112 LCD シリーズ ,ナノ 120 USB シリーズ ,ナノ 130 アドバンストシリーズ ,NUC029 シリーズ ,NUC100/200 アドバンストシリーズ ,NUC120/122/123/220 USB シリーズ ,NUC130/230 CAN シリーズ ,NUC131/NUC1311 CAN シリーズ ,NUC140/240 コネクティビティシリーズ ,Arm Cortex-M4 MCU ,M451 Base シリーズ ,M451M シリーズ ,M452 USB シリーズ ,M453 CAN シリーズ ,NUC442/472 シリーズ ,NUC505 シリーズ
アプリケーション:
機能: Peripherals,Timer and PWM,PWM Output
This website uses cookies to ensure you get the best experience on our website. Learn more
OK