你的问题缺乏上下文,你如何使用TMR1?我可以猜到,但我不需要这样做。我假设你有一个中断服务,它在每次有一个计时器中断时重新加载TMR1H和TMR1L。计时器向上计数,当计数回零时引起中断。因此,如果你想在“Y”计数之后中断,则必须加载定时器W。It(0x10000—y)(事实上,对于快速计数),在计数器中加上“(0x10000—y)”是更可靠的,在中断服务中到达代码时,它可能不为零。
以上来自于百度翻译
以下为原文
Your question lacks any context.
How are you using TMR1?
I can guess, but I shouldn't have to.
I'm assuming you have an interrupt service which reloads TMR1H and TMR1L every time there is a timer interrupt.
Timers count upwards, and cause an interrupt when the count wraps back to zero.
So, if you want an interrupt after "Y" counts, you must load the timer with (0x10000 - Y)
(In fact, for fast counting, it is more reliable to ADD "(0x10000 - Y)" to the value in the counter, which may not be zero by the time it gets to your code in the interrupt service).
你的问题缺乏上下文,你如何使用TMR1?我可以猜到,但我不需要这样做。我假设你有一个中断服务,它在每次有一个计时器中断时重新加载TMR1H和TMR1L。计时器向上计数,当计数回零时引起中断。因此,如果你想在“Y”计数之后中断,则必须加载定时器W。It(0x10000—y)(事实上,对于快速计数),在计数器中加上“(0x10000—y)”是更可靠的,在中断服务中到达代码时,它可能不为零。
以上来自于百度翻译
以下为原文
Your question lacks any context.
How are you using TMR1?
I can guess, but I shouldn't have to.
I'm assuming you have an interrupt service which reloads TMR1H and TMR1L every time there is a timer interrupt.
Timers count upwards, and cause an interrupt when the count wraps back to zero.
So, if you want an interrupt after "Y" counts, you must load the timer with (0x10000 - Y)
(In fact, for fast counting, it is more reliable to ADD "(0x10000 - Y)" to the value in the counter, which may not be zero by the time it gets to your code in the interrupt service).
举报