/******************************************************************
**
** File : TimerA.c | Timer Interrupt |
** Version : 1.0
** Description: TimerA Interrupt
** Author : LightWu
** Date : 2013-4-16
**
*******************************************************************/
#include "MSP430X24X.h"
int Count;
void main(void)
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD; //关狗
P4DIR = BIT0|BIT1|BIT2|BIT3; //设置为输出
P4SEL = 0;
P1IE |= 0x08; // P1.3 interrupt enabled
P1IES |= 0x08; // P1.3 Hi/lo edge
P1IFG &= ~0x08; // P1.3 IFG cleared
//__bis_SR_register(LPM4_bits + GIE); // Enter LPM4 w/interrupt
CCTL0 = CCIE; // CCR0 interrupt enabled
CCR0 = 10;
TACTL = TASSEL_2 + MC_2; // SMCLK, contmode
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
while(1)
{
if( 10 < Count )
{
Count = 0;
P4OUT ^= 0x0F; //电平翻转
}
}
}
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P4OUT ^= 0x0F; //电平翻转
P1IFG &= ~0x08; // P1.3 IFG cleared,注意清标志位,否则会一直进入中断
}
// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
//P4OUT ^= 0x0F; //电平翻转
Count++;
if( 10 < Count )
{
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
}
}
Previous article:MSP430F249 hardware I2C query method to read and write AT24C02
Next article:MSP430F249 external interrupt P1.3 port
- Popular Resources
- Popular amplifiers
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
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [National Technology N32 MCU Development Package] --N32G032 Series
- [STM32WB55 Review] + Registers can be avoided, but RTOS cannot be avoided
- EEWORLD University ---- Linux Embedded Development
- [Today at 10:00 live broadcast] Deep digging into NXP LPC55S69: a new generation of secure and low-power MCU based on ARM Cortex-M33 core
- Playing with Zynq Serial 46——[ex65] Image Laplace Edge Extraction of MT9V034 Camera
- Reading and writing 8-bit data in C2000 series
- [ESP32-Audio-Kit Audio Development Board Review] First Look at the Anxinke Audio Development Board
- How to test the third generation semiconductors? Advanced skills are ready! Collect energy to win prizes! The event has begun~
- Programming example of MSP430 controlling digital tube
- Learn about C2000 32-bit microcontrollers