但是手册上写的是:In center-aligned mode, the counter counts from 0 to the auto-reload value (content of the
TIMx_ARR register) – 1, generates a counter overflow event, then counts from the autoreload value down to 1 and generates a counter underflow event. Then it restarts counting from 0.(在中央对齐模式,计数器从0开始计数到自动加载的值(TIMx_ARR寄存器)−1,产生一个计数器溢出事件,然后向下计数到1并且产生一个计数器下溢事件;然后再从0开始重新计数。)
这样的话,如果里面装1800-1,上升时计数器从0开始计数到1798(上升计了1799个数),然后向下计数到1(1798个数),总共就不是3600了。不知我这样分析对不?
但是手册上写的是:In center-aligned mode, the counter counts from 0 to the auto-reload value (content of the
TIMx_ARR register) – 1, generates a counter overflow event, then counts from the autoreload value down to 1 and generates a counter underflow event. Then it restarts counting from 0.(在中央对齐模式,计数器从0开始计数到自动加载的值(TIMx_ARR寄存器)−1,产生一个计数器溢出事件,然后向下计数到1并且产生一个计数器下溢事件;然后再从0开始重新计数。)
这样的话,如果里面装1800-1,上升时计数器从0开始计数到1798(上升计了1799个数),然后向下计数到1(1798个数),总共就不是3600了。不知我这样分析对不?
谢谢你的回复,可否进一步分析下,谢谢。
我也是这样理解的,手册上的例子也给出了类似的说明。
在向上和向下模式时是从0-1799总共计时1800次
在中央对齐时是0-1798 总共1799,然后再从1799到1又是1799,所以总共计时3598.
我用示波器已经测试了,设的是1800-1,产生的PWM的周期适合的,但是理论上我不理解啊,为什么是这样?和我想的不一样
我用装1800也测试了,周期也是合适的,纠结。。。。。。