找回密码
 立即注册

QQ登录

只需一步,快速开始

开启左侧

[NUC] PWM示例PWM_EnablePeriodInt函数用法

[复制链接]
assman 发表于 2021-8-11 13:23:29 | 显示全部楼层 |阅读模式
各位大大安安,想请问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:45 | 显示全部楼层
PWM_PERIOD_INT_UNDERFLOW  下计数时,计数值和CMRx匹配产生中断    PWM_PERIOD_INT_MATCH_CNR:上计数时,计数值和CMRx匹配产生中断
牛卧堂
回复 支持 反对

使用道具 举报

 楼主| assman 发表于 2021-8-13 13:49:23 | 显示全部楼层
谢谢版大~
回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies |上传

本版积分规则

新唐MCU