嗨,是的,你的理解主要是正确的。为了测量长周期信号,你可以安排处理来自定时器(TMR3)和捕获模块的中断。如果在中断CP之前发生定时器中断,在32位整数变量UIT32 32中添加65536,清除中断标志和LE。当中断捕获发生时,将捕获寄存器的值添加到上述变量中,也可以将捕获寄存器值存储在单独的16位无符号变量UUT1616中,用作下一个间隔的开始时间。这样,你可以精确地捕捉每一个脉冲,而不必重置计时器。周期时间计算可能是这样的:间隔=(CopTraceEndo-CopTrimeRead)+(TimeRyLoop**xx10000);然后用无符号整数类型变量进行计时器和捕获值的计算,然后Calc。即使在一段时间内定时器翻转到零时,被调整的间隔也可以是正确的。或者,这些设备具有定时器和输入捕获,可以安排在32位模式下一起工作,参见寄存器ICXCON2 IC32位的数据表,以及寄存器TXCON-T32位。迈西尔
以上来自于百度翻译
以下为原文
Hi,
Yes, you understanding is mostly correct.
To measure long period signals,
you may arrange to handle interrupts from both the timer (TMR3) and the capture module.
If interrupt from Timer happen before interrupt from CP, add 65536 in a 32 bit integer variable, uint32_t,
clear the interrupt flag and leave the interrupt handler.
When Capture interrupt happen, add value of capture register to the variable mentioned above.
You may also store the capture register value in a separate 16 bit unsigned variable, uint16_t
to use as start time for the next interval. This way, you may capture every pulse precisely, without having to reset the Timer.
Period time calculation may be something like this:
Interval = (Capture_End - Capture_Previous) + (timer_cycles * 0x10000);
Do all calculations of timer and capture values with unsigned integer type variables,
then calculated intervals may be correct even when timer roll around to zero during a period.
Alternatively,
These devices have Timers and Input Capture, that may be arranged to work together in 32 bit mode,
See Datasheet about Register ICxCON2 IC32 bit,
and Register TxCON T32 bit.
Mysil
嗨,是的,你的理解主要是正确的。为了测量长周期信号,你可以安排处理来自定时器(TMR3)和捕获模块的中断。如果在中断CP之前发生定时器中断,在32位整数变量UIT32 32中添加65536,清除中断标志和LE。当中断捕获发生时,将捕获寄存器的值添加到上述变量中,也可以将捕获寄存器值存储在单独的16位无符号变量UUT1616中,用作下一个间隔的开始时间。这样,你可以精确地捕捉每一个脉冲,而不必重置计时器。周期时间计算可能是这样的:间隔=(CopTraceEndo-CopTrimeRead)+(TimeRyLoop**xx10000);然后用无符号整数类型变量进行计时器和捕获值的计算,然后Calc。即使在一段时间内定时器翻转到零时,被调整的间隔也可以是正确的。或者,这些设备具有定时器和输入捕获,可以安排在32位模式下一起工作,参见寄存器ICXCON2 IC32位的数据表,以及寄存器TXCON-T32位。迈西尔
以上来自于百度翻译
以下为原文
Hi,
Yes, you understanding is mostly correct.
To measure long period signals,
you may arrange to handle interrupts from both the timer (TMR3) and the capture module.
If interrupt from Timer happen before interrupt from CP, add 65536 in a 32 bit integer variable, uint32_t,
clear the interrupt flag and leave the interrupt handler.
When Capture interrupt happen, add value of capture register to the variable mentioned above.
You may also store the capture register value in a separate 16 bit unsigned variable, uint16_t
to use as start time for the next interval. This way, you may capture every pulse precisely, without having to reset the Timer.
Period time calculation may be something like this:
Interval = (Capture_End - Capture_Previous) + (timer_cycles * 0x10000);
Do all calculations of timer and capture values with unsigned integer type variables,
then calculated intervals may be correct even when timer roll around to zero during a period.
Alternatively,
These devices have Timers and Input Capture, that may be arranged to work together in 32 bit mode,
See Datasheet about Register ICxCON2 IC32 bit,
and Register TxCON T32 bit.
Mysil
举报