example_lpm3_aclk.c

来自「MSP 430 timer_uart,tmA3的片子可直接使用模块」· C语言 代码 · 共 30 行

C
30
字号
//******************************************************************************
//  MSP430x11x1 Demo - Timer_A, Ultra-Low Pwr UART 4800 Echo, 32kHz ACLK
//  Description: TX is called in ISR, ACLK drives Timer_A and remains on in LPM3
//
//  L. Westlund
//  Texas Instruments Inc.
//  Feb 2006
//  Built with IAR Embedded Workbench Version: 3.40
//*****************************************************************************
#include "ta_uart.h"
#include <msp430x11x1.h>

int callBack( unsigned char c );

void main (void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer

  TI_initTimer(callBack, _32Khz_ACLK_04800_Bitime, TASSEL_1);
  _EINT();
  LPM3;
}

int callBack( unsigned char c )
{
  TI_TA_UART_StatusFlags &= ~TI_TA_RX_RECEIVED; // allows for RX during TX (will not effect TXed byte)
  TI_TX_Byte( c );                          // echo byte
  return TA_UART_STAY_LPM;                  // return to LPM3
}

⌨️ 快捷键说明

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