test44x_tb05.c

来自「AQ430 C Code,支持LSD-TEST430F44X」· C语言 代码 · 共 28 行

C
28
字号

#include <msp430x44x.h>

void main(void)
{ 
  WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
  FLL_CTL0 |= XCAP14PF;                 // Configure load caps
  TBCTL = TBSSEL0 + TBCLR;              // ACLK, clear TBR
  TBCCTL0 = CCIE;                       // TRCCR0 interrupt enabled
  TBCCR0 = 1000;
  P5DIR |= 0x02;                        // Set P5.1 to output direction
  TBCTL |= MC0;                         // Start Timer_B in upmode
  _EINT();                              // Enable interrupts
 
  for (;;)                              
  {
    _BIS_SR(LPM3_bits);                 // Enter LPM3
    _NOP();                             // Required only for C-spy
  }
}

// Timer B0 interrupt service routine
interrupt[TIMERB0_VECTOR] void Timer_B (void)
{
    P5OUT ^= 0x02;                      // Toggle P5.1 using exclusive-OR
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?