msp430f149 Learning Path--PWM signal

Source: Internet
Author: User

Code One:

1 /*******************************2 program function: Aclk=32768hz3 PWM wave t=512/32768 duty ratio 75%4 *********************************/5 6#include <msp430x14x.h>7 voidMain ()8 {9Wdtctl = Wdtpw +Wdthold;TenTactl = Tassel_1 +taclr; One    ACCTL0 =0x00; -CCTL1 =0x00; -    theCCR0 = +-1;//t=512/32768 -CCTL1 =outmod_7; -CCR1 =384;//384/512=0.75 -CCTL2 =outmod_7; +  //CCR2 = 124; -    +P1dir |=bit2;k AP1sel |=BIT2; atP2dir |=BIT0; -P2sel |=BIT0; -    -Tactl |=mc_1;  -}

Code two:

1#include <msp430x14x.h>2 voidINT_CLK ()3 {4BCSCTL1 &= ~Xt2off;5BCSCTL2 |= SELM1 + SELS;//Mclk-->1mhz Smclk-->8mhz6    Do7   {8IFG1 &= ~OFIFG;9      for(intI=0;i< -; i++)Ten _nop (); One} while((IFG1 & OFIFG)! =0); AIFG1 &= ~OFIFG; - } - voidMain () the { -Wdtctl = Wdtpw +Wdthold; - int_clk (); -P1dir |=BIT0; +P1sel |=BIT0; -TACCR0 = -;//PWM f=10khz +TACCR1 = -;//1:1 ATACCTL1 |=outmod_7; atTactl = tassel_2 +mc_1; -}

msp430f149 Learning Path--PWM signal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.