Other Parts Discussed in Thread:CC3200
SDK中pwm频率为2KHz,将分频系数0更改为1,频率小于1kHZ。
只更改了MAP_TimerPrescaleSet(ulBase,ulTimer,1); 如下图
Viki Shi:
PWM模式下prescale不是分频器,注意模式不同,prescale的使用不同:
. Note that when counting down in oneshot or periodic modes, the prescaler acts as a true prescaler and contains the least-significant bits of the count. When counting up in one-shot or periodic modes, the prescaler acts as a timer extension, and holds the most-significant bits of the count. In input edge count, input edge time, and PWM mode, the prescaler always acts as a timer extension, regardless of the count direction.
,
user6314671:
那具体怎么使用才能增加定时器时间间隔?让cc3200 输出频率更低的pwm
,
Viki Shi:
时间间隔基于如下计算:
// // The PWM works based on the following settings: //Timer reload interval -> determines the time period of one cycle //Timer match value -> determines the duty cycle//range [0, timer reload interval] // The computation of the timer reload interval and dutycycle granularity // is as described below: // Timer tick frequency = 80 Mhz = 80000000 cycles/sec // For a time period of 0.5 ms,//Timer reload interval = 80000000/2000 = 40000 cycles // To support steps of duty cycle update from [0, 255] //duty cycle granularity = ceil(40000/255) = 157 // Based on duty cycle granularity, //New Timer reload interval = 255*157 = 40035 //New time period = 0.5004375 ms //Timer match value = (update[0, 255] * duty cycle granularity) // #define TIMER_INTERVAL_RELOAD40035 /* =(255*157) */ #define DUTYCYCLE_GRANULARITY157