sf116 发表于 2021-8-6 11:09

求一个HC32F460 TIM6或TIMA TRIG引脚PWM捕获例子

如题,求TIM6_TRIGA/B或者TIMA_x_TRIG PWM输入捕获例程,谢谢了

sf116 发表于 2021-8-6 11:15

本帖最后由 sf116 于 2021-8-6 11:18 编辑

配置TIM6_TRIGA PWM捕获
1.Timer6_Init,应该配置哪个单元基础定时器?M4_TMR61\2\3?
2.Timer6_SetPeriod,Period register应该选择A\B\C?
3.PORT_SetFunc(PortE, Pin07, Func_Tim6, Disable);,Timer6_PortInputConfig,   enPortSel选择Timer6TrigA,定时器应该选择哪个单元?4.Timer6_ConfigHwCaptureA(M4_TMR61, Timer6HwTrigTimTriARise);Timer6_ConfigHwClear(M4_TMR62, Timer6HwTrigTimTriARise);    Timer6_EnableHwClear(M4_TMR61);
5.Timer6_ConfigIrq,中断类型和中断远应该选哪个?
    Timer6INTENA    = 0u,   ///< Interrupt of count equal to GCMA (or capture input A)
    Timer6INTENB    = 1u,   ///< Interrupt of count equal to GCMB (or capture input B)
    Timer6INTENC    = 2u,   ///< Interrupt of count equal to GCMC
    Timer6INTEND    = 3u,   ///< Interrupt of count equal to GCMD
    Timer6INTENE    = 4u,   ///< Interrupt of count equal to GCME
    Timer6INTENF    = 5u,   ///< Interrupt of count equal to GCMF
    Timer6INTENOVF= 6u,   ///< Interrupt of over flow of sawtooth wave mode or peak point of triangular wave mode
    Timer6INTENUDF= 7u,   ///< Interrupt of under flow of sawtooth wave mode or valley point of triangular wave mode
    Timer6INTENDTE= 8u,   ///< Interrupt of dead timer error
    Timer6INTENSAU= 16u,    ///< Interrupt of count up equally compared with SCMA
    Timer6INTENSAD= 17u,    ///< Interrupt of count down equally compared with SCMA
    Timer6INTENSBU= 18u,    ///< Interrupt of count up equally compared with SCMB
    Timer6INTENSBD= 19u,    ///< Interrupt of count down equally compared with SCMB
6.以上配置完成,硬件启动即可?
Timer6_ConfigHwStart(M4_TMR61, Timer6HwTrigTimTriARise);
Timer6_EnableHwStart(M4_TMR61);

sf116 发表于 2021-8-9 09:10

版主大佬帮个忙?
页: [1]
查看完整版本: 求一个HC32F460 TIM6或TIMA TRIG引脚PWM捕获例子