MSP430F5529 Extra (I) Commonly used built-in functions and some explanations

Publisher:HeavenlySunsetLatest update time:2015-08-20 Source: eefocusKeywords:MSP430F5529 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1) MSP430F5529 supports a maximum operating frequency of 25MHZ, which means that
             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.
Keywords:MSP430F5529 Reference address:MSP430F5529 Extra (I) Commonly used built-in functions and some explanations

Previous article:MSP430F5529 (III) Unified Clock System UCS-1
Next article:MSP430F5529 (II) Watchdog settings

Recommended ReadingLatest update time:2024-11-16 14:54

MSP430F5529 (II) Watchdog settings
The watchdog timer (Watchdog Timer (WDT_A)) is actually a special timer, which can be used as a watchdog or a timer. The so-called watchdog function refers to the ability to monitor whether the program runs away due to some interference or errors. The principle is that when the time of the failure meets the specified
[Microcontroller]
MSP430F5529 (II) Watchdog settings
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号