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

msp430g2xx2 ta 10

1 109 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,48 KB

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

Nội dung

Timer_A is configured // for up mode with CCR0 defining period, TA0 also output on P1.1.. No CPU or // software resources required.. Dang // Texas Instruments Inc.

Trang 1

//****************************************************************************** // MSP430G2xx2 Demo - Timer_A, Toggle P1.1/TA0, Up Mode, DCO SMCLK

//

// Description: Toggle P1.1 using hardware TA0 output Timer_A is configured // for up mode with CCR0 defining period, TA0 also output on P1.1 In this // example, CCR0 is loaded with 500-1 and TA0 will toggle P1.1 at TACLK/500 // Thus the output frequency on P1.1 will be the TACLK/1000 No CPU or

// software resources required

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

// As coded with TACLK = SMCLK, P1.1 output frequency is ~1000000/1000

//

// MSP430G2xx2

//

-// /|\|

XIN|-// | | |

// |RST

XOUT|-// | |

// | P1.1/TA0| > SMCLK/1000

//

// 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 |= 0x02; // P1.1 output

P1SEL |= 0x02; // P1.1 option select

CCTL0 = OUTMOD_4; // CCR0 toggle mode

CCR0 = 500-1;

TACTL = TASSEL_2 + MC_1; // SMCLK, upmode

_BIS_SR(CPUOFF); // CPU off

}

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

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

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

TÀI LIỆU LIÊN QUAN

w