msp430f149 Learning Path--key

Source: Internet
Author: User

Code One:

1 /**********************************2 program function: Use the key to control the LED lights off3 ***********************************/4#include <msp430x14x.h>5 6 voidint_clk ();7 voidMain ()8 {9Wdtctl = Wdtpw +Wdthold;Ten int_clk (); OneP1dir =0Xf0; AP1out =0Xff; -P6dir =0XFF; -P6out =0x00; the    while(1) -   { -     Switch(P1in &0X0F) -     { +      Case 0x0e:P 6OUT =0XC0; Break; -      Case 0x0d:P 6OUT =0X30; Break; +      Case 0x0b:P 6OUT =0X0C; Break; A      Case 0x07:P 6OUT =0X03; Break; at     } -   } - } -  - voidINT_CLK () - { inBCSCTL1 &= ~Xt2off; -BCSCTL2 |= selm_1 +SELS; to    Do +   { -IFG1 &= ~OFIFG; the      for(intI= -;i>0; i--) * _nop (); $} while((IFG1 & OFIFG)! =0);Panax NotoginsengIFG1 &= ~OFIFG; -}

Code two:

1#include <msp430x14x.h>2 3 voidint_clk ();4 voidDelayinti);5 voidMain ()6 {7 int_clk ();8   //Initialize IO9P1dir =0XF0;TenP1out =0XFF; OneP6dir =0XFF; AP6out =0XFF; -    -   if(p1in! =0X0F) the   { -Delay -); -     if(p1in! =0X0F) -     { +       Switch(P1in &0X0F) -       { +        Case 0x0e:P 6OUT =0XFC; Break; A        Case 0x0d:P 6OUT =0xf3; Break; at        Case 0x0b:P 6OUT =0XCF; Break; -        Case 0x07:P 6OUT =0X3F; Break; -       } -     } -   } -   Else inP6out =0XFF; - } to  + voidINT_CLK () - { theBCSCTL1 &= ~Xt2off; *BCSCTL2 |= selm_1 +SELS; $    DoPanax Notoginseng   { -IFG1 &= ~OFIFG; the      for(intI=1;i< -; i++) + _nop (); A} while((IFG1 & OFIFG)! =0); theIFG1 &= ~OFIFG; + } -  $ voidDelayinti) $ { -    while(i--); -}

msp430f149 Learning Path--key

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.