在这个实例中,我固定给EPWM模块的TBPRD寄存器一个值,比如说400,但是用ECAP reference中的example3 中所示的代码捕获:
// Code snippet for CAP mode Delta Time, Rising edge trigger // Initialization Time //======================= // ECAP module 1 config ECap1Regs.ECCTL1.bit.CAP1POL = EC_RISING; ECap1Regs.ECCTL1.bit.CAP2POL = EC_RISING; ECap1Regs.ECCTL1.bit.CAP3POL = EC_RISING; ECap1Regs.ECCTL1.bit.CAP4POL = EC_RISING; ECap1Regs.ECCTL1.bit.CTRRST1 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CTRRST2 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CTRRST3 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CTRRST4 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CAPLDEN = EC_ENABLE; ECap1Regs.ECCTL1.bit.PRESCALE = EC_DIV1; ECap1Regs.ECCTL2.bit.CAP_APWM = EC_CAP_MODE; ECap1Regs.ECCTL2.bit.CONT_ONESHT = EC_CONTINUOUS; ECap1Regs.ECCTL2.bit.SYNCO_SEL = EC_SYNCO_DIS; ECap1Regs.ECCTL2.bit.SYNCI_EN = EC_DISABLE; ECap1Regs.ECCTL2.bit.TSCTRSTOP = EC_RUN; // Allow TSCTR to run // Run Time ( e.g. CEVT1 triggered ISR call) //========================================== // Note: here Time-stamp directly represents the Period value. Period4 = ECap1Regs.CAP1; // Fetch Time-Stamp captured at T1 Period1 = ECap1Regs.CAP2; // Fetch Time-Stamp captured at T2 Period2 = ECap1Regs.CAP3; // Fetch Time-Stamp captured at T3 Period3 = ECap1Regs.CAP4; // Fetch Time-Stamp captured at T4
period1/period2/period3/period4始终比TBPRD中的值大4,无论TBPRD中的值改成多少,捕获的值都有这个情况,
请问这是什么原因造成的?
感应:
我也遇到这种情况了,可是ti员工一遇到这些情况的时候就成缩头乌龟了不给出解释,我的也是明明给定的时2000但是菜啊也能够回来的时候就成2008了,ti员工就捡那些容易回答的去回复
在这个实例中,我固定给EPWM模块的TBPRD寄存器一个值,比如说400,但是用ECAP reference中的example3 中所示的代码捕获:
// Code snippet for CAP mode Delta Time, Rising edge trigger // Initialization Time //======================= // ECAP module 1 config ECap1Regs.ECCTL1.bit.CAP1POL = EC_RISING; ECap1Regs.ECCTL1.bit.CAP2POL = EC_RISING; ECap1Regs.ECCTL1.bit.CAP3POL = EC_RISING; ECap1Regs.ECCTL1.bit.CAP4POL = EC_RISING; ECap1Regs.ECCTL1.bit.CTRRST1 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CTRRST2 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CTRRST3 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CTRRST4 = EC_DELTA_MODE; ECap1Regs.ECCTL1.bit.CAPLDEN = EC_ENABLE; ECap1Regs.ECCTL1.bit.PRESCALE = EC_DIV1; ECap1Regs.ECCTL2.bit.CAP_APWM = EC_CAP_MODE; ECap1Regs.ECCTL2.bit.CONT_ONESHT = EC_CONTINUOUS; ECap1Regs.ECCTL2.bit.SYNCO_SEL = EC_SYNCO_DIS; ECap1Regs.ECCTL2.bit.SYNCI_EN = EC_DISABLE; ECap1Regs.ECCTL2.bit.TSCTRSTOP = EC_RUN; // Allow TSCTR to run // Run Time ( e.g. CEVT1 triggered ISR call) //========================================== // Note: here Time-stamp directly represents the Period value. Period4 = ECap1Regs.CAP1; // Fetch Time-Stamp captured at T1 Period1 = ECap1Regs.CAP2; // Fetch Time-Stamp captured at T2 Period2 = ECap1Regs.CAP3; // Fetch Time-Stamp captured at T3 Period3 = ECap1Regs.CAP4; // Fetch Time-Stamp captured at T4
period1/period2/period3/period4始终比TBPRD中的值大4,无论TBPRD中的值改成多少,捕获的值都有这个情况,
请问这是什么原因造成的?
Zone New:
回复 感应:
别人工程师能够指导,应非常不错了……