1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

msp430g2xx2 ta 03

1 123 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1
Dung lượng 1,55 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

// In this example an ISR triggers when TA overflows.. Inside the TA // overflow ISR P1.0 is toggled.. Toggle rate is approximatlely 12Hz.. // Proper use of TA0IV interrupt vector genera

Trang 1

//****************************************************************************** // MSP430G2xx2 Demo - Timer_A, Toggle P1.0, Overflow ISR, DCO SMCLK

//

// Description: Toggle P1.0 using software and Timer_A overflow ISR

// In this example an ISR triggers when TA overflows Inside the TA

// overflow ISR P1.0 is toggled Toggle rate is approximatlely 12Hz

// Proper use of TA0IV interrupt vector generator is demonstrated

// ACLK = n/a, MCLK = SMCLK = TACLK = default DCO

//

// MSP430G2xx2

//

-// /|\|

XIN|-// | | |

// |RST

XOUT|-// | |

// | P1.0| >LED

//

// D Dang

// Texas Instruments Inc

// December 2010

// Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10

//******************************************************************************

#include <msp430g2452.h>

void main(void)

{

WDTCTL = WDTPW + WDTHOLD; // Stop WDT

P1DIR |= 0x01; // P1.0 output

TACTL = TASSEL_2 + MC_2 + TAIE; // SMCLK, contmode, interrupt

_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt

}

// Timer_A3 Interrupt Vector (TA0IV) handler

#pragma vector=TIMER0_A1_VECTOR

interrupt void Timer_A(void)

{

switch( TA0IV )

{

case 2: break; // CCR1 not used

case 4: break; // CCR2 not used

case 10: P1OUT ^= 0x01; // overflow

break;

}

}

Ngày đăng: 26/12/2017, 07:30

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w