ZHCADO0 January 2024 MSPM0C1104
CCP 通道的输出可被强制为高电平或低电平。此外,仅在 TIMA 中,还可将互补输出通道强制设置为高电平或低电平。表 6-1 展示了软件强制输出操作配置选项。
位字段 | 值 | 说明或注释 |
---|---|---|
SWFRCACT/SWFRCACT_CMPL | 0 | 无强制输出。输出直接来自信号生成块。 |
1 | 强制输出高电平 | |
2 | 强制输出低电平 |
用户可以设置寄存器中的 SWFRCACT 位来强制或释放 PWM 输出。此外,用户可以调用 API 来产生与以下代码所示相同的效果。
/**
* @brief Overrides the timer CCP output
*
* @param[in] gptimer Pointer to the register overlay for the
* peripheral
* @param[in] out Specifies the CCP output state.
* @ref DL_TIMER_FORCE_OUT
* @param[in] outComp If timer insatance supports complementary output,
* it allows to override complementary out also.
* If timer instance doesn't support complementary
* output, this parameter is ignored.
* @ref DL_TIMER_FORCE_CMPL_OUT
* @param[in] ccIndex Index associated to capture compare register
* @ref DL_TIMER_CC_INDEX.
*/
void DL_Timer_overrideCCPOut(GPTIMER_Regs *gptimer, DL_TIMER_FORCE_OUT out,
DL_TIMER_FORCE_CMPL_OUT outComp, DL_TIMER_CC_INDEX ccIndex);