|
要使得TOUT1的输出频率是25MHZ,作了如下配置:
//step1
s2440IOP->rGPBCON &=~(3<<2);
s2440IOP->rGPBCON |=(2<<2);// set GPB1 as TOUT1
//step2
//PWM set
s2440PWM->rTCON &=(~(0xf<<8)) ;// clear manual update bit, stop Timer1
//step3:
s2440PWM->rTCFG0 &= 0xffffff00; // set Timer 0&1 prescaler 0
s2440PWM->rTCFG1 &=0xffffff0f; // set Timer 1 MUX 1/2
//step4:
s2440PWM->rTCNTB1 = ?? ;
s2440PWM->rTCMPB1 = ?? ;
//step5
s2440PWM->rTCON &= (~(0xf<<8));
s2440PWM->rTCON | (0x0e<<8) ;
s2440PWM->rTCON &= (~(0xf<<8));
s2440PWM->rTCON | (0x0d<<8) ; //start timer1
------------------------------------------------------------------
参考资料:
4-bit divider settings Minimum resolution Maximum resolution Maximum interval
(prescaler = 0) (prescaler = 255) (TCNTBn = 65535)
1/2 (PCLK = 50 MHz) 0.0400 us (25.0000 MHz) 10.2400 us (97.6562 KHz) 0.6710 sec
1/4 (PCLK = 50 MHz) 0.0800 us (12.5000 MHz) 20.4800 us (48.8281 KHz) 1.3421 sec
1/8 (PCLK = 50 MHz) 0.1600 us ( 6.2500 MHz) 40.9601 us (24.4140 KHz) 2.6843 sec
1/16 (PCLK = 50 MHz) 0.3200 us ( 3.1250 MHz) 81.9188 us (12.2070 KHz) 5.3686 sec
--------------------------------------------------------------
Timer input clock Frequency = PCLK / {prescaler value+1} / {divider value}
{prescaler value} = 0~255
{divider value} = 2, 4, 8, 16
----------------------------------------------------
问题://step4:
s2440PWM->rTCNTB1 = ?? ;
s2440PWM->rTCMPB1 = ?? ;
中的两项怎么设置?
|
|