#if SYSTEM_SUPPORT_OS //如果需要支持OS.
reload = SYSCLK/8; //每秒钟的计数次数 单位为K = 168/8 = 21
reload *= 1000000 / delay_ostickspersec; //根据delay_ostickspersec设定溢出时间 = 21*1000000/200 = 105000
//reload为24位寄存器,最大值:16777216,在72M下,约合1.86s左右
fac_ms = 1000 / delay_ostickspersec; //代表OS可以延时的最少单位 = 1000 / 200 = 5
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; //开启SYSTICK中断
SysTick->LOAD = reload; //每1/OS_TICKS_PER_SEC秒中断一次 = 105000, every 105000/21000000 = 0.005sec = 5ms to interrupt
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk; //开启SYSTICK
#else
我想请问原子哥,这个语句SysTick->LOAD = reload; //每1/OS_TICKS_PER_SEC秒中断一次 = 105000, every 105000/21000000 = 0.005sec = 5ms to interrupt
是不应该写为SysTick->LOAD = reload-1;才是对的啊??
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
哈哈哈。。。
一周热门 更多>