MSP430 MCU interrupt

Publisher:cwk2003Latest update time:2013-01-10 Source: 21ic Keywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Interrupts are a major feature of the MSP430 microprocessor. Effective use of interrupts can simplify programs and improve execution efficiency. Almost every peripheral module of the MSP430 can generate interrupts, laying the foundation for MSP430 programming for events (i.e., interrupts generated by peripheral modules). The MSP430 enters low-power mode when no event occurs. When an event occurs, the CPU is awakened by an interrupt. After the event is processed, the CPU enters a low-power state again. Since the CPU's operating speed and exit from low power consumption are very fast, in applications, the CPU is in a low-power state most of the time.

There are three types of MSP430 interrupts: system reset, non-maskable interrupt, and maskable interrupt.

(1) The interrupt vector for system reset is 0xFFFE.

(2) The interrupt vector of a non-maskable interrupt is 0xFFFC. When responding to a non-maskable interrupt, the hardware automatically resets OFIE, NMIE, and ACCVIE. The software first determines the interrupt source and resets the interrupt flag, and then executes the user code. Before exiting the interrupt, OFIE, NMIE, and ACCVIE need to be set so that the interrupt can be responded to again. Special attention should be paid: After setting OFIE, NMIE, and ACCVIE, the interrupt corresponding program must be exited immediately, otherwise the interrupt will be triggered again, resulting in interrupt nesting, which will cause stack overflow and make the program execution result unpredictable.

(3) Maskable interrupts are interrupts from peripheral modules with interrupt capabilities, including interrupts generated by overflows when the watchdog timer is operating in timer mode. Each interrupt can be masked by its own interrupt control bit or by the global interrupt control bit.

When multiple interrupt requests occur, the highest priority interrupt is responded to. When responding to an interrupt, MSP430 will reset the non-maskable interrupt control bit SR.GIE. Therefore, once an interrupt is responded to, even if a higher priority maskable interrupt occurs, the interrupt currently being responded to will not be interrupted to respond to another interrupt. However, the SR.GIE reset does not affect non-maskable interrupts, so interrupt requests of non-maskable interrupts can still be accepted.

The process of interrupt response: (1) If the CPU is in active state, complete the current instruction; (2) If the CPU is in low power state, exit the low power state; (3) Push the PC value of the next instruction into the stack; (4) Push the status register SR into the stack; (5) If there are multiple interrupt requests, respond to the highest priority interrupt; (6) The interrupt request flag of a single interrupt source is automatically reset, and the flag of multiple interrupt sources remains unchanged, waiting for software reset; (7) The general interrupt enable bit SR.GIE is reset. The CPUOFF, OSCOFF, SCG1, V, N, Z, and C bits in the SR status register are reset; (8) The corresponding interrupt vector value is loaded into the PC register, and the program starts executing from this address.

The process of interrupt return: (1) Restore the PC value from the stack. If the CPU is in low-power mode before responding to the interrupt, the interrupt can be masked and the low-power mode can still be restored; (2) Restore the PC value from the stack. If the CPU is not in low-power mode before responding to the interrupt, the program continues to execute from this address.

Keywords:MSP430 Reference address:MSP430 MCU interrupt

Previous article:Application of CPLD and MSP430 Microcontroller in Guided Wave Radar Level Meter
Next article:Five low power modes of MSP430 microcontroller

Recommended ReadingLatest update time:2024-11-16 22:02

Detailed explanation of MSP430 crystal oscillator configuration
Compared with MSP430 (F149), MSP430 (F5529) has more powerful functions. About UCS The UCS of the MSP430F5XX/MSP430F6XX series devices contains five clock sources, namely: XT1CLK, VLOCLK, REFOCLK, DCOCLK and XT2CLK. For a detailed introduction to these five clocks, please refer to the instruction manual of this series
[Microcontroller]
MSP430+DMA
Hardware Introduction: The MSP430F15X/16X series microcontrollers have a DMA controller, which can provide a guarantee for high-speed data transmission. For example, the DMA controller can directly transfer the contents of the ADC conversion memory to the RAM unit. The DMA extended by the MSP430 series microcontroller
[Microcontroller]
MSP430+DMA
MSP430F5438 Timer Summary
1.MSP430F5438 has three timers TA0, TA1 and TB, and the functions of the timers are slightly different. 2. For timer TA1, there are two interrupt vector addresses, among which compare match channel 0 has a separate interrupt vector 3. It is difficult to match the name of the MSP430 interrupt vector with TA0 TA1, and i
[Microcontroller]
Design of photoelectric micro-loss blood glucose monitoring system based on MSP430
The World Health Organization pointed out in a 2007 report that there are currently 170 million patients with diabetes mellitus (DM) in the world, and it is predicted that this number will increase dramatically to 299 million by 2025. Diabetes has become the fifth leading cause of death in the world
[Microcontroller]
Design of photoelectric micro-loss blood glucose monitoring system based on MSP430
12864 LCD In-depth Study Notes_2——Based on msp430g2553
7. The following code is to control the LCD to display the picture in full screen. The code is as follows: //Program function: Display two pictures on the 12864 LCD, one is a negative code picture and the other is a positive code picture //  *  I have tried this program and it works.  The LCD is controlled     by tw
[Microcontroller]
A personal in-depth understanding of MSP430-AD12
1. Is the internal AD of msp430 stable? Answer: I checked a lot of information on the Internet, which said that the internal AD of msp430 is not very stable. The first method: I added a 1.25V reference source to the AD channel as the source to be measured (430 uses an internal clock, an internal reference source o
[Microcontroller]
How to use the internal pull-up resistor of MSP430
Today I used the IO of MSP430 as a button. I didn't have an external pull-up resistor. I found that there was a problem after setting the internal pull-up. I thought that the internal pull-up could only be used when outputting. Later I searched for this post on the Internet. It's very good. Repost it.   Today I help
[Microcontroller]
Design of wireless communication system based on MSP430 MCU and nRF905
The wireless communication system consists of two parts: the sending terminal and the receiving terminal. The sending and receiving of data is realized by means of the serial port. The sending terminal sends data through the PC serial port, and then the sending terminal sends the data through nRF905; the receiving t
[Microcontroller]
Design of wireless communication system based on MSP430 MCU and nRF905
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号