牛卧堂MCU技术交流

标题: PWM示例PWM_EnablePeriodInt函数用法 [打印本页]

作者: assman    时间: 2021-8-11 13:23
标题: PWM示例PWM_EnablePeriodInt函数用法
各位大大安安,想请问PWM_EnablePeriodInt这函数的用法,里面参数PWM_PERIOD_INT_UNDERFLOW和PWM_PERIOD_INT_MATCH_CNR各代表什么意思,谢谢!

/**
* @brief Enable period interrupt of selected channel
* @param[in] pwm The pointer of the specified PWM module
* @param[in] u32ChannelNum PWM channel number. Valid values are between 0~3
* @param[in] u32IntPeriodType Period interrupt type, could be either
*              - \ref PWM_PERIOD_INT_UNDERFLOW
*              - \ref PWM_PERIOD_INT_MATCH_CNR
* @return None
* @details This function is used to enable period interrupt of selected channel.
*          Every two channels, (0 & 1), (2 & 3), shares the period interrupt type setting.
*/
void PWM_EnablePeriodInt(PWM_T *pwm, uint32_t u32ChannelNum,  uint32_t u32IntPeriodType)
{
    (pwm)->PIER = ((pwm)->PIER & ~(PWM_PIER_INT01TYPE_Msk << (u32ChannelNum >> 1))) | \
                  (PWM_PIER_PWMIE0_Msk << u32ChannelNum) | (u32IntPeriodType << (u32ChannelNum >> 1));
}


作者: admin    时间: 2021-8-13 10:27
PWM_PERIOD_INT_UNDERFLOW  下计数时,计数值和CMRx匹配产生中断    PWM_PERIOD_INT_MATCH_CNR:上计数时,计数值和CMRx匹配产生中断
作者: assman    时间: 2021-8-13 13:49
谢谢版大~




欢迎光临 牛卧堂MCU技术交流 (http://nuvoton-mcu.com/) Powered by Discuz! X3.2