Flashing light with interrupt
******************************************************************************/
#include
/****************************************
msp430G2553 controls the flashing of two LEDs connected to P1.0 and P1.6
The flashing effect can be set in array form, and the array value is assigned to output P1 in a loop.
******************************************/
char dis[12]={0x41,0x00,0x41,0x00,0x01,0x00,0x40,0x00,0x40,0x00,0x01,0x00};
//Define an array dis[12] with 12 elements, which can store 12 display states
int n,t,m;
void delay()
/*Set a custom function. If it is set before the main program, it can be set directly. If it is set after the main program, it must be declared before the main program Declare it before the main program
, and then set it after the main program*/
{
while(t--);
}
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog_EINT
();
P1DIR &=~BIT3;
P1IE |= BIT3;
P1IES |=BIT3;
P1IFG =0x00;
P1DIR |=(BIT0+BIT6);//Set P1.0 and P1.6 as outputs, and the rest of the states remain unchangedwhile
(1)
{
for (n=0;n<12;n++)
{
P1OUT=dis[n];
delay(100);
}
}
}
#pragma vector=PORT1_VECTOR
__interrupt void MM(void)
{
if ((P1IFG & BIT3)==BIT3)
{
P1OUT |=BIT0;
for (m=1;m<15;m++)
{
P1OUT^=(BIT0);
delay(5);
}
}
P1IFG &=0x00;
}
Previous article:Stepper motor driver assembly program and debugging summary
Next article:MSP430 MCU drives LCD1602 C language program
- 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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- What are the various calculation rates of floating-point instructions and fixed-point instructions of C66x DSP?
- How to configure the driving resistance in parallel with the MOS tube and how to determine the turn-on voltage?
- Power supply_7.4V to 24V, what chip should I use?
- When a capacitor on a PCBA explodes, does it turn black or just break into powder?
- TouchGFX Design + Jigsaw Puzzle
- FSF sends hard drive to Microsoft, hoping to open source Windows 7
- New uses for old phones (8) - Remote access
- Here it comes! 6G tasks for the 14th Five-Year Plan
- DSP decimal conversion
- [Jihai APM32E103VET6S MINI Development Board Review] Part 5: Software Triggering ADC