| 数据搜索系统,热门电子元器件搜索 |
|
SLAS191A 数据表(PDF) 30 Page - Texas Instruments |
|
|
|||||||||||||||||||||||||||||
SLAS191A 数据表(HTML) 30 Page - Texas Instruments |
|
30 / 86 page ![]() 1–24 $ML1 BIT.B #01h,P0IN ; Test P0.0 JNZ $ML1 ; Do nothing if P0.0 low 1.2.13 How to Use an Interrupt Routine Assemble and download the file gs_stk4.asm in the examples directory, as described previously. 1. When an interrupt occurs, the program sends the contents of the program counter and status register to the stack. 2. Next, the program branches to the starting address of the interrupt routine. 3. The interrupt routine normally ends with the RETI instruction. 4. The RETI instruction loads the data, which was saved to the stack at the beginning of the interrupt routine, to the status register and program counter. 5. The program continues from the point of interruption. Using interrupt routines allows the MSP430 to use low power modes. Selecting a low power mode causes the program to stop at the current position, and an activity that causes an interrupt automatically clears the low power mode. The interrupt continues program execution at the starting address of the corresponding interrupt routine. The RETI loads the saved program data to the status register and program counter. Loading the status register and program counter clears out the low power mode bits, and the program continues with the next instruction. Figure 1–20 is the Basic Timer Interrupt routine. BIS #CPUOFF,SR ; set CPUoff Bit ;**************************************************************************** ; Basic Timer Interrupt routine ;**************************************************************************** Int_BT ; Basic Timer 128 Hz (7.8 ms) DEC.B lcd_timer ; decrement SW lcd-timer JNZ Int_BT_end ; !0 : no action BIC #CPUOFF,0(SP) ; Clear CPUoff Bit MOV.B #lcd+ival,lcd_timer ; = 0 : load again Int_BT_end RETI To use the interrupts, the interrupt vector table must be set up as follows: ;**************************************************************************** ; Interrupt vectors ;**************************************************************************** .sect ”int_Vect”, USER_END-31 .word RESET ; no source .word Int_BT ; Basic Timer .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; no source .word RESET ; NMI, Osc. fault .word RESET ; POR, ext. Reset, Watchdog .end Figure 1–20. Basic Timer Interrupt Routine |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |