Häufig gestellte Fragen

FAQ

What should be considered when using PWM output function in the NuMicro® family?  Datum: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);
Produkte: Mikrocontroller ,Arm Cortex-M0-MCUs ,M051-Base-Serie ,M0518-Serie ,M0519-Serie ,Mini51-Base-Serie ,Nano100/102-Base-Serie ,Nano110/112-LCD-Serie ,Nano120-USB-Serie ,Nano130-Advanced-Serie ,NUC029-Serie ,NUC100/200-Advanced-Serie ,NUC120/122/123/220-USB-Serie ,NUC130/230-CAN-Serie ,NUC131-NUC1311-CAN-Serie ,NUC140/240-Konnektivität-Serie ,Arm Cortex-M4-MCUs ,M451-Base-Serie ,M451M-Serie ,M452-USB-Serie ,M453-CAN-Serie ,NUC442/472-Serie ,NUC505-Serie
Applikationen:
Funktion: Peripherals,Timer and PWM,PWM Output
This website uses cookies to ensure you get the best experience on our website. Learn more
OK