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

msp430g2xx2 ta 20

1 116 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,64 KB

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

Nội dung

Normal operating mode is LPM3.

Trang 1

//****************************************************************************** // MSP430G2xx2 Demo - Timer_A, PWM TA1, Up/Down Mode, 32kHz ACLK

//

// Description: This program generates one PWM output on P1.2 using

// Timer_A configured for up/down mode The value in CCR0, 128, defines the // PWM period/2 and the value in CCR1 the PWM duty cycle Using

// 32kHz ACLK as TACLK, the timer period is 7.8ms with a 75% duty cycle on // P1.2 Normal operating mode is LPM3

// ACLK = TACLK = LFXT1 = 32768Hz, MCLK = default DCO

// //* External watch crystal installed on XIN XOUT is required for ACLK *// //

// MSP430G2xx2

//

-// /|\|

XIN|-// | | | 32kHz

// |RST

XOUT|-// | |

// | P1.2/TA1| > CCR1 - 75% PWM

//

// 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 |= 0x0C; // P1.2 and P1.3 output

P1SEL |= 0x0C; // P1.2 and P1.3 TA1/2 otions

CCR0 = 128; // PWM Period/2

CCTL1 = OUTMOD_6; // CCR1 toggle/set

CCR1 = 32; // CCR1 PWM duty cycle

TACTL = TASSEL_1 + MC_3; // ACLK, up-down mode

_BIS_SR(LPM3_bits); // Enter LPM3

}

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