共2条
1/1 1 跳转至页
PWM 请教版主:PWM脉冲问题?我的程序
问
#include "MSP430x12x.h"
; ACLK = TACLK = LFXT1 = default DCO ~ 800kHz.
; Normal mode LPM3
; //*External watch crystal installed on XIN XOUT is required for ACLK*//
;
; MSP430F123(2)
; -----------------
; /|\| XIN|-
; | | |
; --|RST XOUT|-
; | |
; | P1.2|--> CCR1 - 50% PWM
; | P1.3|--> CCR2 - 50% PWM
;******************************************************************************
;------------------------------------------------------------------------------
ORG 0E000h ; Program Start
;------------------------------------------------------------------------------
RESET mov.w #300h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
MOV.B #0FEH,&P2DIR
MOV.B #008H,&P2IE
MOV.B #0,&P2IES
EINT
Mainloop bis.w #LPM3, SR ; Enter LPM3
nop ; Required only for C-spy
SetupTA mov.w #TASSEL1+TACLR,&TACTL ; ACLK, Clear TAR
SetupC0 mov.w #10,&CCR0 ; PWM Period/2
SetupC1 mov.w #OUTMOD_2,&CCTL1 ; CCR1 toggle/reset
mov.w #5,&CCR1 ; CCR1 PWM Duty Cycle
SetupC2 mov.w #OUTMOD_6,&CCTL2 ; CCR2 toggle/set
mov.w #5,&CCR2 ; CCR2 PWM duty cycle
SetupP1 bis.b #00Ch,&P1DIR ; P1.2 and P1.3 output
bis.b #00Ch,&P1SEL ; P1.2 and P1.3 TA1/2 otions
bis.w #MC1+MC0,&TACTL ; Start Timer_A in up-down mode
RETI ;
;------------------------------------------------------------------------------
; Interrupt Vectors Used MSP430x12x(2)
;------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
ORG 0FFE6H
DW SetupTA
END
是否可以利用P2.0中断产生脉冲输出?
怎么来做延时1S,然后才产生4MS的脉冲信号?
; ACLK = TACLK = LFXT1 = default DCO ~ 800kHz.
; Normal mode LPM3
; //*External watch crystal installed on XIN XOUT is required for ACLK*//
;
; MSP430F123(2)
; -----------------
; /|\| XIN|-
; | | |
; --|RST XOUT|-
; | |
; | P1.2|--> CCR1 - 50% PWM
; | P1.3|--> CCR2 - 50% PWM
;******************************************************************************
;------------------------------------------------------------------------------
ORG 0E000h ; Program Start
;------------------------------------------------------------------------------
RESET mov.w #300h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
MOV.B #0FEH,&P2DIR
MOV.B #008H,&P2IE
MOV.B #0,&P2IES
EINT
Mainloop bis.w #LPM3, SR ; Enter LPM3
nop ; Required only for C-spy
SetupTA mov.w #TASSEL1+TACLR,&TACTL ; ACLK, Clear TAR
SetupC0 mov.w #10,&CCR0 ; PWM Period/2
SetupC1 mov.w #OUTMOD_2,&CCTL1 ; CCR1 toggle/reset
mov.w #5,&CCR1 ; CCR1 PWM Duty Cycle
SetupC2 mov.w #OUTMOD_6,&CCTL2 ; CCR2 toggle/set
mov.w #5,&CCR2 ; CCR2 PWM duty cycle
SetupP1 bis.b #00Ch,&P1DIR ; P1.2 and P1.3 output
bis.b #00Ch,&P1SEL ; P1.2 and P1.3 TA1/2 otions
bis.w #MC1+MC0,&TACTL ; Start Timer_A in up-down mode
RETI ;
;------------------------------------------------------------------------------
; Interrupt Vectors Used MSP430x12x(2)
;------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
ORG 0FFE6H
DW SetupTA
END
是否可以利用P2.0中断产生脉冲输出?
怎么来做延时1S,然后才产生4MS的脉冲信号?
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |