there is a limit to how fast you can increase the system speed by multiplying the frequency of the phase-locked loop, and
the maximum can only be 25MHZ (no point in going any higher).
2) Several important inline functions
(inline functions are defined in intrinsics.h, but these functions
do not need to be declared in advance when used)
①__bic_SR_register();
Clear certain bits in the SR register in the CPU. That is, clear the bits in the brackets.
Example: __bic_SR_register(GIE); // Clear the GIE bit, that is, turn off the general interrupt
②__bis_SR_register();
Set certain bits in the SR register in the CPU to 1. That is, set the bits in the brackets to 1.
③ __interrupt
is placed in front of the function to mark the interrupt function. The following program is the interrupt service function of the watchdog
WDT. WDT_VECTOR is the interrupt vector of the watchdog. For example:
#pragma vector=WDT_VECTOR
__interrupt void WatchDog(void)
{… }
④ __monitor
is placed before the function to declare that the interrupt will be automatically disabled when this function is executed. Such functions should be shortened as much as possible, otherwise, the interrupt event cannot be responded to in time.
⑤ __bic_SR_register_on_exit();
Function: When an interrupt function or a non-interruptible function (flag is __monitor) returns, some bits in the CPU SR register are cleared to 0.
⑥ __bis_SR_register_on_exit();
Function: When an interrupt function or a non-interruptible function (flag is __monitor) returns, some bits in the CPU SR register are set to 1.
⑦ __no_init
is placed in front of the global variable, and its function is to prevent the variable from being assigned an initial value when the program starts
. ⑧ __disable_interrupt
turns off the general interrupt.
Another expression with the same function is: _DINT()
⑨ __enable_interrupt
turns on the general interrupt.
Another expression with the same function is: _EINT()
⑩__even_in_range( , );
is often used in the query of multi-source interrupts, such as switch( __even_in_range(TAIV, 10)
means:
the statements in the switch function will only be executed when the value of TAIV is an even number between 0 and 10. Its function is to improve the efficiency of the switch statement.
A. _NOP()
is a no-operation operation, equivalent to the __no_operation instruction .
B. __get_SP_register(void)
function: returns the value of the stack pointer register SP.
C. __get_SR_register_on_exit(void)
function: used when an interrupt function or a non-interruptible function
(flagged as __monitor) returns, returns the value of the status register SR.
D. __bcd_add_short(unsigned short, unsigned short);
function: adds two 16-bit BCD format numbers and returns the sum.
E. __bcd_add_long(unsigned long, unsigned long);
function: adds two 32-bit BCD format numbers and returns the sum.
F. __delay_cycles(x);
The system's own precise delay. x must be a constant or a constant expression. If it is a variable, the compilation will report an error! The delay time is x multiplied by the clock cycle of MCLK
(3) Regarding how to deal with a large number of MSP430 registers:
There are too many MSP430 registers, and it is too difficult to remember each one. So, my suggestion is that when learning, remember the important and commonly used registers.
As for the many other registers, you only need to have an impression and know which settings these registers can control. When you use them specifically, look up the technical manual;
(4) The header file msp430f5529.h
not only defines the declaration of each register, but also defines a lot of very convenient things.
For example, if you want to enter low power mode 1: LPM1;
for example, if you want to select the clock of timer A0 as SMCLK:
the most original way is TA0CTL=0x0200, but now there is a clearer way TA0CTL=TASSEL_2; //Clock source selection mode 2
So we must continue to explore and accumulate!
(5) Interrupt register name
Everyone knows how to write an interrupt function. The pattern is:
#pragma vector = interrupt vector address (name)
__interrupt void custom interrupt function name (void)
{… }
But if you want to write it, you must first know what the interrupt vector is called .
So far, we have encountered the watchdog interrupt WDT_VECTOR, the external interrupt PORT2_VECTOR of pin P2, the timer A0 (CCR1-CCR4 and TAIFG) interrupt TIMER0_A1_VECTOR
and a large number of interrupt vectors. We don’t know what to do with the names yet.
Open msp430f5529.h and scroll to the bottom of the file to display the various interrupt vector names defined, as well as explanations.
(6)
The biggest feature of MSP430 is low power consumption, which is reflected in all aspects. At the overall level, MSP430 can set the working mode of the entire system to meet the working requirements and reduce power consumption.
In order to reduce power consumption, the processor has several considerations:
one is to lower the operating voltage (3.3V for F5529 is very low, and the internal core voltage VCORE is even lower);
the second is to turn off the module functions that are not in use temporarily (each module of F5529 can run independently, such as timer, A/D conversion, watchdog, etc. can all work independently when the CPU is in sleep state. If the main CPU is required to work, any module can wake up the CPU through an interrupt, so that the system can run with the lowest power consumption.
);
the third method is to reduce the operating clock frequency.
Previous article:MSP430F5529 (III) Unified Clock System UCS-1
Next article:MSP430F5529 (II) Watchdog settings
Recommended ReadingLatest update time:2024-11-16 14:54
- Popular Resources
- Popular amplifiers
- 2021 Electric Competition A Question (Signal Distortion Measurement Device) Provincial First Prize Code
- MSP430 MCU Principles and Applications - Introduction, Improvement and Development of MSP430F5xx6xx Series MCUs (2nd Edition)
- Tracking car developed based on MSP430
- 2019 Electric Competition Question A - Dynamic Wireless Charging System for Electric Cars (Shandong University)
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!
- 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
- Linux self-study notes (I) Please criticize and correct me, and learn together
- How to prevent copying of FPGA code running on the board
- Application of MSP430F5xxx in the highway toll collection system (ETC)
- Today is World Environment Day
- TI TMS320F2812 SVPWM Program
- High impedance circuit protection issues
- MCU drives 24V solenoid valve
- The PWM output signal of the 28335 chip is always high
- uboot logo replacement problem
- MYZR Virtual Machine System Guide