MSP430 MCU interrupt system

Publisher:caoda143Latest update time:2013-02-22 Source: 21icKeywords: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.

Please refer to the relevant materials for the interrupt vector tables of each series of MSP430.

Keywords:MSP430 Reference address:MSP430 MCU interrupt system

Previous article:MSP430 MCU Hardware Knowledge - 5 Low Power Modes
Next article:What kind of microcontroller is the most promising?

Recommended ReadingLatest update time:2024-11-16 16:52

Design of Dual Integral A/D Circuit Based on Single Chip Microcomputer
0 Introduction A/D conversion circuit is an important part of data acquisition system, and also an important functional interface in computer application system. There are two commonly used A/D conversion chips on the market. One is the successive approximation type, such as AD1674, which is characterized by hi
[Microcontroller]
Application design of solar photovoltaic DC controller based on AVR microcontroller
0 Introduction Energy shortage and environmental pollution are becoming increasingly serious in the world today, forcing people to find and use new alternative energy sources. With the improvement of electronic technology and solar panel production technology, the use of solar energy is becoming more and more common
[Microcontroller]
Application design of solar photovoltaic DC controller based on AVR microcontroller
Freescale 16-bit MCU (Part 2) - CodeWarrior development environment construction
1. Install CodeWarrior       The development environment for Freescale's 16-bit microcontroller is CodeWarrior5.1. This software is easy to install and the installation file can be downloaded from the corresponding website. The hardware resources of the computer required to install CodeWarrior are also relatively broa
[Microcontroller]
Freescale 16-bit MCU (Part 2) - CodeWarrior development environment construction
Application and practice of Proteus in single chip microcomputer teaching and scientific and technological production
With the rapid development of computers, a large number of EDA software have been introduced into the teaching of electronic majors. For example, in the courses of circuit analysis, analog electronic technology and digital electronic technology, EWB simulation software is often introduced into teaching to improve th
[Microcontroller]
Application and practice of Proteus in single chip microcomputer teaching and scientific and technological production
An example program for music playback based on PIC microcontroller
Example program for music playback using PIC microcontroller ********************************** * Music playback using PIC microcontroller * ******************************** Source program: The following program uses two timer resources. It can be implemented on any PIC microcontroller w
[Microcontroller]
IC card reader/writer implemented with PIC16F877 microcontroller
introduction The main purpose of this design is to introduce the data storage technology and data communication of IC card, so memory card is used. Since this design can communicate with IC card synchronously and asynchronously with host computer, it is necessary to select a microcontroller with both commun
[Microcontroller]
IC card reader/writer implemented with PIC16F877 microcontroller
SAM4E MCU Tour - 4. LED Flashing PWM
Although the two LED lights can flash, it always requires the participation of the CPU. Now try to use a more automated method: let the pulse width modulation (PWM) controller output a square wave with a certain period and duty cycle to control the on and off of the LED lights.   1. Implementation ideas   We still us
[Microcontroller]
SAM4E MCU Tour - 4. LED Flashing PWM
Communication experiment between computer and single chip microcomputer
  This article is about the application of the communication experiment between computers and single-chip microcomputers. It mainly includes the explanation of the experimental principle, hardware circuit diagram, source program, etc.   Contents:   1. Application of MCU serial communication   2. PC controls the M
[Microcontroller]
Communication experiment between computer and single chip microcomputer
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号