共2条
1/1 1 跳转至页
msp430,lpm3,demo,lpm3 以下是msp430的lpm3的demo程序,我只改了延时的长度。为何程序一直没法从lpm3模式中出来!急呀
问
#include "MSP430x11x.h"
;------------------------------------------------------------------------------
ORG 0FC00h ; Program Start cpu=MSP430f1101
;------------------------------------------------------------------------------
RESET mov.w #300h,SP ; Initialize stackpointer
SetupBC bis.b #DIVA1,&BCSCTL1 ; ACLK/4
SetupWDT mov.w #WDT_ADLY_1000,&WDTCTL ; WDT 1s*4 interval timer
bis.b #WDTIE,&IE1 ; Enable WDT interrupt
SetupP1 mov.b #0FFh,&P1DIR ; All P1.x outputs
clr.b &P1OUT ; All P1.x reset
SetupP2 mov.b #0FFh,&P2DIR ; All P2.x outputs
clr.b &P2OUT ; All P2.x reset
eint ; Enable interrupts
;
Mainloop bis.w #GIE+CPUOFF+SCG1+SCG0,SR ; Enter LPM3
bis.b #001h,&P1OUT ; Set P1.0
push.w #20000 ; Delay to TOS
Delay dec.w 0(SP) ; Decrement TOS
jnz Delay ; Delay over?
incd.w SP ; Clean stack
bic.b #001h,&P1OUT ; Reset P1.0
jmp Mainloop ; Again
;
;------------------------------------------------------------------------------
WDT_ISR; Exit all LPMx modes, reti returns system active with GIE enabled
;------------------------------------------------------------------------------
bic.w #CPUOFF+SCG1+SCG0,0(SP) ; System active on TOS
reti ;
;
;------------------------------------------------------------------------------
; Interrupt Vectors Used MSP430x11x1
;------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
ORG 0FFF4h ; WDT Vector
DW WDT_ISR ;
END 答 1: 可以啊。
;------------------------------------------------------------------------------
ORG 0FC00h ; Program Start cpu=MSP430f1101
;------------------------------------------------------------------------------
RESET mov.w #300h,SP ; Initialize stackpointer
SetupBC bis.b #DIVA1,&BCSCTL1 ; ACLK/4
SetupWDT mov.w #WDT_ADLY_1000,&WDTCTL ; WDT 1s*4 interval timer
bis.b #WDTIE,&IE1 ; Enable WDT interrupt
SetupP1 mov.b #0FFh,&P1DIR ; All P1.x outputs
clr.b &P1OUT ; All P1.x reset
SetupP2 mov.b #0FFh,&P2DIR ; All P2.x outputs
clr.b &P2OUT ; All P2.x reset
eint ; Enable interrupts
;
Mainloop bis.w #GIE+CPUOFF+SCG1+SCG0,SR ; Enter LPM3
bis.b #001h,&P1OUT ; Set P1.0
push.w #20000 ; Delay to TOS
Delay dec.w 0(SP) ; Decrement TOS
jnz Delay ; Delay over?
incd.w SP ; Clean stack
bic.b #001h,&P1OUT ; Reset P1.0
jmp Mainloop ; Again
;
;------------------------------------------------------------------------------
WDT_ISR; Exit all LPMx modes, reti returns system active with GIE enabled
;------------------------------------------------------------------------------
bic.w #CPUOFF+SCG1+SCG0,0(SP) ; System active on TOS
reti ;
;
;------------------------------------------------------------------------------
; Interrupt Vectors Used MSP430x11x1
;------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
ORG 0FFF4h ; WDT Vector
DW WDT_ISR ;
END 答 1: 可以啊。
共2条
1/1 1 跳转至页
回复
我要赚赏金打赏帖 |
|
|---|---|
| 片外存储Flash使用方法(Arduino IDE环境)被打赏¥22元 | |
| 三分钟快速上手ESP-NOW(ArduinoIDE环境)被打赏¥23元 | |
| 【S32K3XX】LPSPI参数配置说明被打赏¥21元 | |
| 在WT9932C61-TINY上实现超声波测距被打赏¥22元 | |
| 基于WT9932C61-TINY的环境构建及OLED屏驱动测试被打赏¥20元 | |
| 【S32K3XX】Core-to-Core 中断使用被打赏¥21元 | |
| 「AI编程记录--含源码」用一晚上的时间写一个esp32的示波器被打赏¥19元 | |
| STM32C0116DK开发探索记(3)被打赏¥30元 | |
| STM32C0116DK开发探索记(2)被打赏¥24元 | |
| STM32C0116DK开发探索记(1)被打赏¥29元 | |
我要赚赏金
