Example program:
//******************************************************************************
// MSP-FET430P140 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.
// As coded with TACLK = SMCLK, P1.1 output frequency is ~800000/1000.
// SMCLK = MCLK = TACLK = default DCO ~800kHz
//
// MSP430F149
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// | P1.1/TA0|--> SMCLK/1000
//
// M. Buccini
// Texas Instruments Inc.
// Feb 2005
// Built with IAR Embedded Workbench Version: 3.21A
//修改时间:2008.8.20 am 8:13
// only timera 依靠DCO工作,而CPU 停止工作。
//******************************************************************************
#include
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
}
//******************************************************************************
// MSP-FET430P140 Demo - Timer_A, Toggle P1.1/TA0, Up/Down Mode, 32kHz ACLK
//
// Description: Toggle P1.1 using hardware TA0 output. Timer_A is configured
// for up/down mode with CCR0 defining period, TA0 also output on P1.1. In
// this example, CCR0 is loaded with 5 and TA0 will toggle P1.1 at TACLK/2*5.
// Thus the output frequency on P1.1 will be the TACLK/20. No CPU or software
TA0 ACLK/20 // // M. Buccini
// Texas
Instruments
Inc.
//
Feb
2005
//
Built
with
IAR
Embedded
Workbench
Version
:
3.21A
//
******************************************************************************
#include
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 = 5;
TACTL = TASSEL_1 + MC_3; // ACLK, up-downmode
_BIS_SR(LPM3_bits); // Enter LPM3
}
Previous article:MSP430 simulated serial port program
Next article:4*4 keyboard function with buffered interrupt response
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- [Analog Electronics Course Selection Test] + Input and Output Limitation
- 【LAUNCHXL-CC2650】Tool or software download and installation and SDK directory introduction
- Core Experience | Free evaluation and trial of Lingdong MM32 eminiboard, waiting for you!
- The most efficient solution for receiving and sending indefinite length packets on DSP serial port SCI
- (There are still many prizes left in the prize pool!) Mentor downloads the white paper and answers questions for a prize draw
- Be sure to pay attention to safety when driving on the road! Stay away from large vehicles!
- LCD screen display effect is related to viewing angle and contrast
- Flip switch based on LIS2DW12 of PSOC6;
- Discussion about MicroPython Engineer's Pocket Toolbox
- Smart gaming dice supporting LED, Bluetooth, wireless charging