|
MSP430F5529 生成PWM波 with CCS
[复制链接]
大概就是通过时钟来产生某个确定频率的PWM波
用FPGA可以得到更完美的波形,不过如果只是提供一个CLK波的话F5529LP就完全可以做到
#include
unsigned int temp;
int main(void) {
WDTCTL = WDTPW | WDTHOLD; //关闭看门狗
//Initialize
P1DIR |= BIT0;
P1OUT |= BIT0;
P1SEL |= BIT2; //从P1.2输出
P1DIR |= BIT2;
//初始化定时器
TA0CTL |= TASSEL_2 + ID_0 ;
TA0CCTL1 = OUTMOD_7;
TA0CCR0 = /*Period*/; //Change me
TA0CCR1 = /*Duty*/; //Change me
__delay_cycles(2000);
__bis_SR_register(LPM4_bits + GIE);
return 0;
}
|
|