//
// MSP430G2xx3
// -----------------
// /|| XIN|-
// | | |
// --|RST XOUT|-
// P1.3|KEY P1.6|-->LED
// | P1.0|-->LED
// Authorhttp ://jiwm.blog.163.com
// Built with IAR Embedded Workbench Version: 5.40
/
// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{ TACCTL0&=~ CCIE; //Disable interrupt
static unsigned char KEY_State=0; //Key state variable
switch(KEY_State) //Process key state
{case NOKEY: //Key processing when no key is pressed
if ((P1IN&BIT3)==0)
{KEY_State=PUSH_KEY; //After pressing the key, enter the short press state
}
break;
case PUSH_KEY: //Perform key processing in the short press state
if((P1IN&BIT3)!=0) //Release the key, consider it as a short press, and process it
{KEY=1; //Key assignment
KEY_State=NOKEY; //Return to the unpressed state
}
break;
}
TACCTL0|= CCIE; //Open interrupt
}
Previous article:MSP430G2553 test program (serial port program, timer mode)
Next article:MSP430G2553 test program (breathing light)
Recommended ReadingLatest update time:2024-11-17 02:57
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- What are the options for isolated DAC/ADC? APC & PAC chips
- How to eliminate glitches in combinational circuits?
- TMS320F2803x Series Real-time Control MCU Technical Documentation
- Simple analysis of the difference between STM32 and 51
- A senior project used a digital tube, a three-pin inductor, and a three-pin capacitor.
- Understanding Balun in one article (functional principle, performance parameters, basic types)
- Small Cells Will Have a Big Impact
- Practical sharing: The harm of Miller effect to MOSFET switching process
- Last day! Free review of Beetle ESP32-C3, hurry up and get it
- SVPWM principle, implementation, simulation analysis