This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5529定时器配置

Other Parts Discussed in Thread: MSP430F5529

请问怎么用MSP430F5529做出这种效果,就是短按P1.1按键,P1.2所连的灯亮,长按P1.1按键,P1.3所连的灯亮,双击P1.1按键,P1.4所连的灯亮。

这怎么做?  我一直没做出来.......

谢谢大佬,爱你们哦!!!!!!!!

  • 你需要的只是一个按键的驱动,要准确的识别按键的单击、双击、长按等状态,推荐网上找找按键的状态机程序。
  • 您能不能说的详细一点....... 我太小白了
  • 您可以看一下TI例程,这个是去poll P1.4来选择是否设置P1.0

    现在您的主要问题是区分不同的按键方式,需要根据您现在的按键情况来实现不同的灯亮

    //******************************************************************************
    //  MSP430TC0701 Demo - Software Poll P1.4, Set P1.0 if P1.4 = 1
    //
    //  Description: Poll P1.4 in a loop, if hi P1.0 is set, if low, P1.0 reset.
    //  ACLK = n/a, MCLK = SMCLK = default DCO
    //
    //              MSP430TC0701
    //            -----------------
    //        /|\|              XIN|-
    //         | |                 |
    //         --|RST          XOUT|-
    //     /|\   |                 |
    //      --o--|P1.4         P1.0|-->LED
    //     \|/
    //
    //   Bhargavi Nisarga
    //   Texas Instruments Inc.
    //   April 2009
    //   Built with CCSv4 and IAR Embedded Workbench Version: 4.21
    //******************************************************************************
    #include <msp430.h>
    
    int main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
      P1DIR |= BIT0;                            // Set P1.0 to output direction
    
      while (1)                                 // Test P1.4
      {
        if (P1IN & BIT4)
          P1OUT |= BIT0;                        // if P1.4 set, set P1.0
        else
          P1OUT &= ~BIT0;                       // else reset
      }
    }