1. Interruption
① polling mode and interrupt mode
Polling (Polling) mode: The CPU actively queries the peripheral, the peripheral is in a passive position, inefficient execution, long wait time.
Interrupt (Interrupt) mode: The CPU provides services to the peripherals by responding to interrupt requests, the peripherals are active, the CPU can concentrate on other programs or hibernate when the peripherals are not interrupted, and the execution efficiency is high.
②430 Interrupt System
Three interrupts: System reset
unshielded Interrupt (nonmaskable)
Shielded Interrupt (maskable)
Interrupt Precedence (priority)
Warning: Here the masking and non-masking refers to the effect of gie on interrupt triggering, both NMI and Mi may be closed by their own independent interrupt switch.
③ Interrupt Response Process
1. Complete the current instruction
2, the PC into the stack
3, the SR into the stack
4. When there are multiple interrupt requests, respond to high-priority interrupts, gie zero, shielding other interrupts from happening
5, Qing 0 single-source interrupt request flag, multi-source terminal will not automatically clear the flag bit
6, in addition to SCG0, the other bits of SR are initialized, allowing the microcontroller to enter the active mode from a low power mode.
7, the interrupt vector into the PC, into the Interrupt service sub-program
④ Interrupt return process
When RETI
1. SR Out Stack
2, PC out of the stack
⑤C430 Interrupt Service subroutine writing format
#pragma vector= interrupt vector vector
__interrupt void function name (void)
{...}
2. MSP430 clock System (UCS)
Ucs->unified clock System Unified clocking systems
① Three types of clocks
ACLK: Auxiliary Clock Auxiliary
MCLK: Master Clock masker
SMCLK: Subsystem clocks subsystem Masker Clock
② Five kinds of clock sources
XT1CLK: Low frequency or high frequency universal clock source (32768Hz or 4mhz~32mhz).
Low-freq or High-freq oscillator, can be used with 32768Hz watch
Crystals, standard crystals, resonators, or external clock sources in the 4MHz
To 32MHz.
vloclk: Internal ultralow Power Low frequency oscillator (10KHZ)->RC oscillator with poor stability.
Internal very low power, low frequency oscillator with ten KHz
Typical frequency.
REFOCLK: Internal low Frequency oscillator (32768HZ), used as reference clock source.
Internal, trimmed, low-freq oscillator with 32768 Hz typical
Frequency, with the ability to is used as a clock reference into the FLL.
dcoclk: Numerical control oscillator output clock, can be set in batch with lock frequency loop (FLL), Dcoclkdiv is DCOCLK 1,2,4,8,16,32 frequency output.
Internal digitally-controlled Oscillator (DCO) that can is stabilized by
The FLL.
xt2clk: Optional High frequency oscillator (4mhz~32mhz)
Optional High-freq oscillator that can is used with standard crystals,
resonators, or external clock sources in the 4MHz to 32MHz range. Xt2clk
Can is used as a clock reference into the FLL.
③ Numerical control oscillator output frequency setting
The FLL reference clock enters the FLL, through the Fllrefdiv division after the input 10-bit frequency counter positive end, counter output count value control DCO frequency generator, generated DCOCLK,DCOCLK by Flld divided by
Dcoclkdiv, the negative end of the input frequency counter after Flln, when the positive and negative end frequency is consistent, the counter output value is unchanged, the FLL stable output dcoclk and dcoclkdiv.
Calculation formula: fllrefclk/n=dcoclkdiv/(n+1)
④ucs Initial Configuration condition
XT1CLK in low-freq mode, ACLK choose XT1CLK, if XT1CLK error, then automatically switch to REFOCLK.
MCLK and SMCLK choose Dcoclkdiv.
FLLREFCLK Choose Xt1clk.
XT2CLK is not enabled by default.
3. Low power consumption
Chapter3 interrupts, clocks and low power consumption